forPelevin / gomoji

Helpful functions to work with emoji in Golang
MIT License
190 stars 28 forks source link

feature request: replace emoji with slug #18

Closed TristanSpeakEasy closed 1 year ago

TristanSpeakEasy commented 1 year ago

would be great to have a method to replace emojis with their slug

forPelevin commented 1 year ago

hey @TristanSpeakEasy

Thank you for the feature request.

Just to make sure that we are on the same page. Are you looking for something like this?

    res := gomoji.ReplaceWithSlug("🧖 hello 🦋 world") // "person-in-steamy-room hello butterfly world"
TristanSpeakEasy commented 1 year ago

Yeah that is exactly it, I would like to convert the original intent of the string into full text. Just removing the emoji's for me could end up in conflicts between strings that need to be unique. So if I can replace the emoji with the slug like in your example that would solve my use case.

forPelevin commented 1 year ago

Het @TristanSpeakEasy

I made a change with a new functionality. Please, update the library and check the docs https://github.com/forPelevin/gomoji#replace-all-emojis-with-the-result-of-custom-replacer-function Also, you can use the ReplaceEmojisWithSlug function in your case.

I hope, the change covers your needs.

TristanSpeakEasy commented 1 year ago

This is perfect thank you, will Open new issues if I have any problem with it

forPelevin commented 1 year ago

Great. Again, thank you for the feature request. Have a nice day