 |
StringReplace
StringReplace["
string
",
"
"
->
"
"] or StringReplace["
string
",
"
"
->
"
",
"
"
->
"
", ...
] replaces the "
" by "
" whenever they appear as substrings of "
string
".
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. Setting the option IgnoreCase
->
True makes StringReplace treat lower- and upper-case letters as equivalent. See the Mathematica book: Section 2.7.2. See also: Replace, StringReplacePart, StringPosition, ToLowerCase, ToUpperCase.
Further Examples
This replaces each occurrence of the string "ab" with the string "oz"; "Ab" does not match "ab".
In[1]:= 
Out[1]= 
With IgnoreCase switched to True, "Ab" now matches "ab".
In[2]:= 
Out[2]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. | | | |
 | |
|