Adding characters
"customer" <> "s"
Removing characters
Elixir idiomatic:
String.trim_trailing("users", "s")
#⇒ "user"
More efficient for long strings:
with [_ | tail] <- "users" |> to_charlist |> :lists.reverse,
do: tail |> :lists.reverse |> to_string
Most efficient (credits to @Dogbert):
str = "users"
sz = :erlang.byte_size(str),
:erlang.binary_part(str, {0, sz - 1})
6
solved Inserting and removing a character from a string