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".

StringReplacePart["snew",{m,n}]

represents an operator form of StringReplacePart that can be applied to an expression.

Details

Examples

open allclose all

Basic Examples  (3)

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]=

Use the operator form of StringReplacePart:

In[1]:=
Click for copyable input
Out[1]=

Scope  (3)

Applications  (1)

Properties & Relations  (3)

Possible Issues  (1)

See Also

StringInsert  StringDrop  StringReplace  StringJoin  ReplacePart

Tutorials

Introduced in 1996
(3.0)
| Updated in 2016
(10.4)