Cldr v0.0.16 Cldr.Number.String
String helper functions
Summary
Functions
Split a string up into fixed size chunks
Replace any non-latin1 characters with a ?
Replaces characters with a string hex representation
Returns a regex which matches all latin1 characters
Returns a regex which matches all non-latin1 characters
Pad a a string (representing a number) with leading “0”‘s to the specified length
Pad a a string (representing a number) with trailing “0”‘s to the specified length
Functions
Split a string up into fixed size chunks.
Returns a list of strings the size of size
plus potentially
one more chunk at the end that is the remainder of the string
after chunking.
Examples
iex> Cldr.Number.String.chunk_string("This is a string", 3)
["Thi", "s i", "s a", " st", "rin", "g"]
iex> Cldr.Number.String.chunk_string("1234", 4)
["1234"]
iex> Cldr.Number.String.chunk_string("1234", 3)
["123","4"]
iex> Cldr.Number.String.chunk_string("1234", 3, :reverse)
["1", "234"]
Pad a a string (representing a number) with leading “0”‘s to the specified length.
number
is a string representation of a numbercount
is the final length required of the string