View Source ElixirCLRut.Formatter (ElixirCLRUT v1.0.3)
Cleans and give format to RUT strings.
Link to this section Summary
Functions
Removes all chars (except for numbers and letter K) from the RUT.
Adds dots to a list of rut characters.
Gives format to a normalized RUT.
Transforms a RUT string to a list of numbers. Converts lowercase to uppercase.
Link to this section Functions
Removes all chars (except for numbers and letter K) from the RUT.
examples
Examples
iex> clean("2228250-6")
"22282506"
iex> clean("14.193.432-5")
"141934325"
Adds dots to a list of rut characters.
examples
Examples
iex> dots([2, 0, 9, 6, 1, 6, 0, 5])
"20.961.605"
iex> dots([2, 0, 9, 6, 1, 6, 0, 5], ",")
"20,961,605"
iex> dots([2, 0, 9, 6, 1, 6, 0, 5], ",", 3)
"20,961,605"
Gives format to a normalized RUT.
examples
Examples
iex> format(ElixirCLRut.from("20961605-K"))
"20.961.605-K"
iex> format(ElixirCLRut.from("141231553"))
"14.123.155-3"
iex> format(ElixirCLRut.from("141231553"), separator: "")
"14123155-3"
iex> format(ElixirCLRut.from("14123155", false))
"14.123.155-3"
Transforms a RUT string to a list of numbers. Converts lowercase to uppercase.
examples
Examples
iex> normalize("2228250-6")
[2, 2, 2, 8, 2, 5, 0, 6]
iex> normalize("14.193.432-5")
[1, 4, 1, 9, 3, 4, 3, 2, 5]