Files
iban-ex/lib/iban_ex/commons/commons.ex
Danylo Negrienko 763e1dba0c ADD IBAN FIELD TO STRUCTS AND UPDATE PARSING LOGIC
- Added `iban` field to the `IbanEx.Iban` struct to hold the full IBAN value. - Updated the parsing logic to populate
the new field. - Adjusted BBAN rules and tests for France and Brazil to reflect updated structures. - Improved error
handling and format validation routines.
2025-11-30 11:04:09 -05:00

29 lines
609 B
Elixir

defmodule IbanEx.Commons do
@moduledoc false
@spec blank(nil | binary()) :: nil | binary()
def blank(nil), do: nil
def blank(""), do: nil
def blank(string) when is_binary(string), do: string
@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)
# |> case do
# "" -> nil
# result -> result
# end
end
end