philomena/lib/search/string.ex

14 lines
240 B
Elixir
Raw Normal View History

2019-11-02 21:31:55 +01:00
defmodule Search.String do
def normalize(nil) do
""
end
2019-11-02 21:31:55 +01:00
def normalize(str) do
str
|> String.replace("\r", "")
|> String.split("\n", trim: true)
|> Enum.map(fn s -> "(#{s})" end)
|> Enum.join(" || ")
end
end