topstrrepl
string routines
Return value
another string
Parameters
str
in
required
agument1
rchar
in
required
Examples
; Convert one letter into upper case
abc = 'abcdefghijklmnopqrstuvwxyz'
print,strrepl(abc,strpos(abc,'m'),'M')
; prints "abcdefghijklMnopqrstuvwxyz"
; Use with strwhere function
a = 'abcabcabc'
print,strrepl(a,strwhere(a,'a'),'#')
; prints "#bc#bc#bc#bc#bc"
IDL> print, strrepl(a,'bc','!eeee!')
a!eeee!a!eeee!a!eeee!
IDL> print, strrepl(a,'b','0000')
a0000ca0000ca0000
IDL> print, strrepl(a,'toto','0000')
abcabcabc
Version history
Version
$Id: strrepl.pro 134 2006-07-07 10:19:08Z navarro $
History
mgs, 02 Jun 1998: VERSION 1.00
Known issues
Restrictions
Known shortcoming: if index is an array, it must contain all
valid elements (only the first entry is checked).