Ergo.Utils (Ergo v0.8.0)
Link to this section Summary
Functions
Examples
iex> Ergo.Utils.char_to_string(?H)
"H"
iex> Ergo.Utils.char_to_string(?h)
"h"
iex> Ergo.Utils.char_to_string(?\r)
"\r"
iex> Ergo.Utils.char_to_string(?\n)
"\n"
iex> Ergo.Utils.char_to_string(?\t)
"\t"
If the string str
is longer than max
(default: 40) it is truncated to 37 chars and "..." is added to the end, otherwise it is returned unaltered.
Link to this section Functions
Link to this function
char_to_string(c)
Examples
iex> Ergo.Utils.char_to_string(?H)
"H"
iex> Ergo.Utils.char_to_string(?h)
"h"
iex> Ergo.Utils.char_to_string(?\r)
"\r"
iex> Ergo.Utils.char_to_string(?\n)
"\n"
iex> Ergo.Utils.char_to_string(?\t)
"\t"
Link to this function
ellipsize(str, max \\ 40)
If the string str
is longer than max
(default: 40) it is truncated to 37 chars and "..." is added to the end, otherwise it is returned unaltered.
Examples
iex> Ergo.Utils.ellipsize("frob")
"frob"
iex> Ergo.Utils.ellipsize("123456789012345678901234567890123456789012345678901")
"1234567890123456789012345678901234567..."
iex> Ergo.Utils.ellipsize("12345678901234567890", 10)
"1234567..."
iex> Ergo.Utils.ellipsize("12345", 4)
"1..."