Wolfram ResearchPRODUCTSPURCHASEFOR USERSCOMPANYOUR SITES
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.

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"]LongRightArrow .
• The string expression patt can contain any of the objects specified in the notes for StringExpression.
• Example: StringPosition["abcadcacb", "a"~~_~~"c"]LongRightArrow .
• 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]LongRightArrow .
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.
• See Section 2.8.2.
• New in Version 2; modified in 5.1.


Any questions about topics on this page? Click here to get an individual response.Buy NowFree TrialMore Information



 © 2008 Wolfram Research, Inc.  Terms of Use  Privacy Policy |
Sign up for our newsletter: