2024-03-05 11:02:58 +00:00
|
|
|
defmodule IbanEx.Commons do
|
2024-03-07 23:39:33 +00:00
|
|
|
@moduledoc false
|
|
|
|
|
2024-03-05 11:02:58 +00:00
|
|
|
@spec normalize(binary()) :: binary()
|
|
|
|
def normalize(string) do
|
|
|
|
string
|
|
|
|
|> to_string()
|
|
|
|
|> String.replace(~r/\s*/i, "")
|
|
|
|
|> String.upcase()
|
|
|
|
end
|
|
|
|
|
|
|
|
@spec normalize_and_slice(binary(), Range.t()) :: binary()
|
|
|
|
def normalize_and_slice(string, range) do
|
|
|
|
string
|
|
|
|
|> normalize()
|
|
|
|
|> String.slice(range)
|
2024-05-11 15:52:34 +00:00
|
|
|
# |> case do
|
|
|
|
# "" -> nil
|
|
|
|
# result -> result
|
|
|
|
# end
|
2024-03-05 11:02:58 +00:00
|
|
|
end
|
|
|
|
end
|