String.pad_leading
You're seeing just the function
pad_leading
, go back to String module for more information.
Specs
pad_leading(t(), non_neg_integer(), t() | [t()]) :: t()
Returns a new string padded with a leading filler
which is made of elements from the padding
.
Passing a list of strings as padding
will take one element of the list
for every missing entry. If the list is shorter than the number of inserts,
the filling will start again from the beginning of the list.
Passing a string padding
is equivalent to passing the list of graphemes in it.
If no padding
is given, it defaults to whitespace.
When count
is less than or equal to the length of string
,
given string
is returned.
Raises ArgumentError
if the given padding
contains a non-string element.
Examples
iex> String.pad_leading("abc", 5)
" abc"
iex> String.pad_leading("abc", 4, "12")
"1abc"
iex> String.pad_leading("abc", 6, "12")
"121abc"
iex> String.pad_leading("abc", 5, ["1", "23"])
"123abc"