Obsolete/
strrepl.pro
replace one (or more) character(s)/string(s) in a string
--- OBSOLETE --- you should better use strsed
strrepl
String
result = strrepl(str, arg2, rchar)
Return value
another string
Parameters
str
in
required
the string to be changed
arg2
in
required
position of the character(s) to be replaced or a string to be changed in STR.
rchar
in
required
replacement character/string
Examples
Convert one letter into upper case
IDL> abc = 'abcdefghijklmnopqrstuvwxyz'
IDL> print,strrepl(abc,strpos(abc,'m'),'M')
abcdefghijklMnopqrstuvwxyz
Use with strwhere function
IDL> a = 'abcabcabc'
IDL> print,strrepl(a,strwhere(a,'a'),'#')
#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 371 2008-08-07 09:32:02Z pinsard $
History
mgs, 02 Jun 1998: VERSION 1.00
Copyright (C) 1998, Martin Schultz, Harvard University
This software is provided as is without any warranty
whatsoever. It may be freely used, copied or distributed
for non-commercial purposes. This copyright notice must be
kept with any copy of this software. If this software shall
be used commercially or sold as part of a larger package,
please contact the author to arrange payment.
Bugs and comments should be directed to mgs@io.harvard.edu
with subject "IDL routine strrepl"
sebastien Masson (smlod@ipsl.jussieu.fr)
Known issues
Restrictions
Known shortcoming: if index is an array, it must contain all
valid elements (only the first entry is checked).
Produced by IDLdoc 2.0.