ToBeReviewed/STRING/
strsed.pro
replace one (or more) character(s)/string(s) in a string array
"modern" version of the obsolete strrepl
strsed
String
result = strsed(str, exp1, exp2, FOLD_CASE=FOLD_CASE)
Return value
string array or scalar
Parameters
str
in
required
type: string array or scalar
the string to be changed
exp1
in
required
type: scalar string
a single regular expression (as implemented by the STREGEX function).
exp2
in
required
type: scalar string
replacement character/string
Keywords
FOLD_CASE
Indicates that the regular expression matching should be done in
a case-insensitive fashion.
Examples
IDL> abc = 'abcdefghijklmnopqrstuvwxyz'
IDL> print, strsed(abc, 'm', 'M')
abcdefghijklMnopqrstuvwxyz
IDL> print, strsed(abc, 'm.*t', 'M_T')
abcdefghijklM_Tuvwxyz
IDL> a = 'abcabcabc'
IDL> help, strsed([abc, a, 'eee'], 'abc', 'XXX_')
STRING = Array[3]
IDL> print, strsed([abc, a, 'eee'], 'abc', 'XXX_')
XXX_defghijklmnopqrstuvwxyz XXX_XXX_XXX_ eee
Version history
Version
$Id: strsed.pro 372 2008-08-08 12:31:53Z pinsard $
History
Sept 2006: Sebastien Masson (smasson@lodyc.jussieu.fr)
Produced by IDLdoc 2.0.