Logo

Programming-Idioms

History of Idiom 63 > diff from v45 to v46

Edit summary for version 46 by programming-idioms.org:
[Elixir] 404

Version 45

2020-02-28, 09:26:39

Version 46

2020-05-10, 21:38:51

Idiom #63 Replace fragment of a string

Assign to x2 the value of string x with all occurrences of y replaced by z.
Assume occurrences of y are not overlapping.

Idiom #63 Replace fragment of a string

Assign to x2 the value of string x with all occurrences of y replaced by z.
Assume occurrences of y are not overlapping.

Variables
x2,x,y,z
Extra Keywords
substring substitute
Extra Keywords
substring substitute
Code
x2 = String.replace(x, y, z)
Code
x2 = String.replace(x, y, z)
Doc URL
http://elixir-lang.org/docs/stable/elixir/String.html#replace/4
Doc URL
https://hexdocs.pm/elixir/String.html#replace/4