It works if I hardcode my string when passing it to String.replace(/3):
String.replace("username", "", ".")
=> ".u.s.e.r.n.a.m.e.
But I´d like to run String.replace(/3) on the content that I have in my variable:
username = 'marcel_huber'
new_username = String.replace(username, "", ".")
** (FunctionClauseError) no function clause matching in String.replace/4
The following arguments were given to String.replace/4:
# 1
'marcel_huber'
# 2
""
# 3
"."
# 4
[]
Attempted function clauses (showing 1 out of 1):
def replace(subject, pattern, replacement, options) when is_binary(subject) and is_binary(replacement) or is_function(replacement, 1) and is_list(options)
(elixir 1.14.0) lib/string.ex:1521: String.replace/4
iex:7: (file)
How can I make this work?