Initial commit
This commit is contained in:
16
lib/iban_ex/commons/commons.ex
Normal file
16
lib/iban_ex/commons/commons.ex
Normal file
@@ -0,0 +1,16 @@
|
||||
defmodule IbanEx.Commons do
|
||||
@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)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user