Searches a string for a substring and replaces all found occurrences with a new text.
StringReplace(s, x, y[, f[, δ]])
sis the string to be searched
xis the substring to search for
yis the text to change
fis a string
δis a positive integer
x are strings, then
x and replaces all found occurrences of
f specifies flags for the algorithm. It is a string that can contain zero or more of the following characters:
xin a case-insensitive manner.
xto be a substring of
xis found as a full word in
f defaults to
"" (no options).
δ is specified,
StringReplace will begin searching
x at character index
s (the first character having index 1).
Alice ≔ ExampleData("Alice in Wonderland");
StringReplace(Alice, "Alice", "Harry", "i")
Harry’S ADVENTURES IN WONDERLAND Lewis Carroll THE MILLENNIUM FULCRUM EDITION 3.0 CHAPTER I. Down the Rabbit-Hole Harry was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, ‘and what is the use of a book,’ thought Harry ‘without pictures or conversations?’ So she was considering in her own mind (as well as she could, for the hot day made her feel very sleepy and stupid), whether the pleasure of making a daisy-chain would be worth the trouble of getting up and picking the daisies, when suddenly a White Rabbit with pink eyes ran close by her. There was nothing so VERY remarkable in that; nor did Harry think it so VERY much out of the way to hear the Rabbit say to itself, ‘Oh dear! Oh dear! I shall be late!’ (when she thought it over afterwards, it occurred to her that she ought to have wondered a…