String.replace_suffix
You're seeing just the function
replace_suffix
, go back to String module for more information.
Specs
Replaces suffix in string
by replacement
if it matches match
.
Returns the string untouched if there is no match. If match
is an empty
string (""
), replacement
is just appended to string
.
Examples
iex> String.replace_suffix("hello", " world", "")
"hello"
iex> String.replace_suffix("hello world", " world", "")
"hello"
iex> String.replace_suffix("hello world world", " world", "")
"hello world"
iex> String.replace_suffix("hello", " world", " mundo")
"hello"
iex> String.replace_suffix("hello world", " world", " mundo")
"hello mundo"
iex> String.replace_suffix("hello world world", " world", " mundo")
"hello world mundo"
iex> String.replace_suffix("hello", "", " world")
"hello world"