This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

StringReplacePart

StringReplacePart["string", "snew", {m, n}]
replaces the characters at positions m through n in "string" by "snew".
StringReplacePart["string", "snew", {{m1, n1}, {m2, n2}, ...}]
inserts copies of "snew" at several positions.
StringReplacePart["string", {"snew1", "snew2", ...}, {{m1, n1}, {m2, n2}, ...}]
replaces characters at positions mi through ni in "string" by "snewi".
  • When a list of "snewi" is given, its length must be the same as the length of the list of positions.  »
  • When multiple positions are given, all refer to the original "string", before any replacements have been done.
Replace characters 2 through 5 with a new string:
In[1]:=
Click for copyable input
Out[1]=
 
Replace several sequences of characters with a new string:
In[1]:=
Click for copyable input
Out[1]=
New in 3