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

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


FilledSmallSquare StringPosition["string", "sub"] gives a list of the starting and ending character positions at which "sub" appears as a substring of "string".

FilledSmallSquare StringPosition["string", "sub", k] includes only the first k occurrences of "sub".

FilledSmallSquare StringPosition["string", "", "", ... ] gives positions of all the "".

FilledSmallSquare Example: StringPosition["abbaabbaa", "bb"] LongRightArrow.

FilledSmallSquare With the default option setting Overlaps -> True, StringPosition includes substrings that overlap. With the setting Overlaps -> False such substrings are excluded.

FilledSmallSquare Setting the option IgnoreCase -> True makes StringPosition treat lower- and upper-case letters as equivalent.

FilledSmallSquare Example: StringPosition["abAB", "a", IgnoreCase -> True] LongRightArrow.

FilledSmallSquare StringPosition returns sequence specifications in the form used by StringTake, StringDrop and StringReplacePart.

FilledSmallSquare See Section 2.8.2.

FilledSmallSquare See also: Position, Characters, FindList, ReplaceList.

FilledSmallSquare New in Version 2.

Further Examples