StringReplacePart

StringReplacePart["string","snew",{m,n}]
replaces the characters at positions m through n in by .

StringReplacePart["string","snew",{{m1,n1},{m2,n2},}]
inserts copies of at several positions.

StringReplacePart["string",{"snew1","snew2",},{{m1,n1},{m2,n2},}]
replaces characters at positions through in by .

StringReplacePart["snew",{m,n}]
represents an operator form of StringReplacePart that can be applied to an expression.

DetailsDetails

ExamplesExamplesopen allclose all

Basic Examples  (3)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]=
Introduced in 1996
(3.0)
| Updated in 2016
(10.4)
Translate this page: