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 .

DetailsDetails

  • StringReplacePart uses position specifications in the form returned by StringPosition. »
  • When a list of 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 , before any replacements have been done.
  • StringReplacePart[s,"",] can be used to delete substrings. »
Introduced in 1996
(3.0)