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

Documentation / Mathematica / Built-in Functions / Programming / String Manipulation /

StringReplacePart

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

FilledSmallSquare StringReplacePart["string", "snew", , , , , ... ] inserts copies of "snew" at several positions.

FilledSmallSquare StringReplacePart["string", "", "", ... , , , , , ... ] replaces characters at positions through in "string" by "".

FilledSmallSquare StringReplacePart uses position specifications in the form returned by StringPosition.

FilledSmallSquare When a list of "" is given, its length must be the same as the length of the list of positions.

FilledSmallSquare When multiple positions are given, all refer to the original "string", before any replacements have been done.

FilledSmallSquare StringReplacePart[s, "", ... ] can be used to delete substrings.

FilledSmallSquare See Section 2.8.2.

FilledSmallSquare See also: StringInsert, StringDrop, StringReplace, StringJoin, ReplacePart.

FilledSmallSquare New in Version 3.

Further Examples