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

StringReplace

Usage

StringReplace["string", s -> sp] or StringReplace["string", { ->  ,  ->  , ... }] replaces the string expressions  by  whenever they appear as substrings of "string".
StringReplace["string", srules, n] does only the first n replacements.
StringReplace[{ ,  , ... }, srules] gives the list of results for each of the  .


Notes

• Example: StringReplace["abbaabbaa", "ab"->"X"]LongRightArrow .
• The string expressions  can contain any of the objects specified in the notes for StringExpression.
StringReplace 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. If any of the rules apply, it replaces the substring, then continues to go through the string, starting at the character position after the end of the substring.
• If the  in the replacements  -> do not evaluate to strings, StringReplace 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 StringReplace treat lower- and upper-case letters as equivalent.
• 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: