Skip to content

Commit

Permalink
Fix emojify (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
theogf committed May 6, 2021
1 parent f490eeb commit f6ab8da
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/emojify.jl
Expand Up @@ -28,11 +28,19 @@ end

function emojify_string(str::String)
for func in 🔑(func_to_emojis)
str = replace(str, Regex("\\b" * string(func) * "\\b") => RandString(string.(func_to_emojis[func])))
str = replace(str, Regex("\\b" * string(func) * "\\b") => RandString(to_string.(func_to_emojis[func])))
end
return str
end

function to_string(emoji::Symbol)
string(emoji)
end

function to_string(emoji::Tuple)
return string(emoji[1])
end

## Allow to get a random string every time it's printed
struct RandString{TS}
strings::TS
Expand Down

0 comments on commit f6ab8da

Please sign in to comment.