Use a binary comprehension

Instead of converting to a charlist and back.
This commit is contained in:
Adam Millerchip 2019-11-07 11:12:57 +09:00
parent cc9e0386f0
commit dbc2a91b15

View file

@ -182,9 +182,7 @@ defmodule LineBotSample do
code
|> String.trim()
|> String.upcase()
|> String.to_charlist()
|> Enum.map(&(&1 + 0x1F1A5))
|> List.to_string()
|> (&for(<<cp::utf8 <- &1>>, into: "", do: <<cp + 0x1F1A5::utf8>>)).()
log_and_reply(request_message, %Message.Text{text: code}, reply_token)
end