Mathematica 9 is now available

StringReplaceList

Usage

StringReplaceList["string", s -> sp] or StringReplaceList["string", { ->  ,  ->  , ... }] gives a list of the strings obtained by replacing each individual occurrence of substrings in "string" matching the string expressions  .
StringReplaceList["string", srules, n] gives a list of the first n results obtained.
StringReplaceList[{ ,  , ... }, srules] gives the list of results for each of the  .


Notes

• Example: StringReplaceList["aaa", "a" -> "X"]LongRightArrow .
• The string expressions  can contain any of the objects specified in the notes for StringExpression.
• In each of the results returned by StringReplaceList only one substring has been replaced.
StringReplaceList goes through a string, testing substrings that start at each successive character position. On each substring, it tries in turn each of the transformation rules you have specified, returning a result for each one that applies.
StringReplaceList in effect carries out a single step in the evolution of a multiway system.
• If the  in the replacements  -> do not evaluate to strings, StringReplaceList will yield a StringExpression rather than an ordinary string.
• In replacements of the form  :>  , the  are not evaluated until each time they are used.
• Setting the option IgnoreCase -> True makes StringReplaceList treat lower- and upper-case letters as equivalent.
• See Section 2.8.2.
• New in Version 5.1.


Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.