|
SOLUTIONS
|
BUILT-IN MATHEMATICA SYMBOL
StringPosition
StringPosition["string", "sub"]
gives a list of the starting and ending character positions at which
appears as a substring of
.
StringPosition["string", patt]
gives all positions at which substrings matching the general string expression patt appear in
.
StringPosition["string", patt, n]
includes only the first n occurrences of patt.
StringPosition["string", {patt1, patt2, ...}]
gives positions of all the
.
StringPosition[{s1, s2, ...}, p]
gives the list of results for each of the
.
Details and OptionsDetails and Options
- The string expression patt can contain any of the objects specified in the notes for StringExpression.
- With the default option setting Overlaps->True, StringPosition includes substrings that overlap. With the setting Overlaps->False, such substrings are excluded. »
- With Overlaps->All, multiple substrings that match the same string expression are all included. With Overlaps->True, only the first such matching substring at a given position is included. »
- Setting the option IgnoreCase->True makes StringPosition treat lowercase and uppercase letters as equivalent. »
- StringPosition returns sequence specifications in the form used by StringTake, StringDrop, and StringReplacePart. »
- StringPosition["string", RegularExpression["regex"]] gives positions of substrings matching the specified regular expression.
New in 2 | Last modified in 5.1
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
