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
1 changed files with 1 additions and 3 deletions

View File

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