StringPosition
Usage
• StringPosition["string", "sub"] gives a list of the starting and ending character positions at which "sub" appears as a substring of "string". • StringPosition["string", patt] gives all positions at which substrings matching the general string expression patt appear in "string". • StringPosition["string", patt, n] includes only the first n occurrences of patt. • StringPosition["string", { , , ... }] gives positions of all the . • StringPosition[{ , , ... }, p] gives the list of results for each of the .
Notes
• Example: StringPosition["abbaabbaa", "bb"]  . • The string expression patt can contain any of the objects specified in the notes for StringExpression. • Example: StringPosition["abcadcacb", "a"~~_~~"c"]  . • 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 lower- and upper-case letters as equivalent. • Example: StringPosition["abAB", "a", IgnoreCase -> True]  . • StringPosition["string", RegularExpression["regex"]] gives positions of substrings matching the specified regular expression. • New in Version 2; modified in 5.1.
|