general/misc/SSW/
ssw_str_replace.pro
Routines
top source ssw_str_replace
result = ssw_str_replace(source, insub, outsub)
Name: ssw_str_replace Purpose: replace all occurences of a substring with a replacement if no replacement string is specified, a NULL is inserted Input Parameters: source - source string (vector ok) insub - target string for replace outsub - replacement string - default is NULL String (per 2001 mod) (pre 2001 default was a BLANK) Calling Example: new=ssw_str_replace(strings,'old','new') ; new=ssw_str_replace(strings,'asdfa,' ') ; replace 'asdfa' with ' ' new=ssw_str_replace(strings,'x','') ; remove 'x' (-> null) new=ssw_str_replace(strings,'x') ; same (default=NULL) History: slf, 11/19/91 slf, 19-mar-93 ; optimize case where insub and outsub ; are each 1 character in length mdm, 21-Jul-97 ; patch to handle big arrays fz, 12-May-98 ; change loop variable to long Zarro (EITI/GSFC), 17-Mar-01, used STRPOS instead of WHERE when checking for delimiters 26-Jul-2005 - S.L.Freeland - DOCUMENTATION ONLY changed Documented default delimiter from blank to null since the CODE default was changed in the 2001 modification Zarro (L-3Com/GSFC), 23-Oct-05; protect against insub/outsub coming in as vectors Zarro (ADNET), 30-Jan-09; added additional checks for insub/outsub coming in as vectors Zarro (ADNET), 11-June-10, increased string limit to 200000 jmm, 23-sep-2013, renamed to avoid name conflict with ssl_general str_replace.pro, replaced str2arr and arr2str with strsplit, strjoin.
Parameters
- source
- insub
- outsub
File attributes
Modification date: | Thu Feb 13 16:43:43 2014 |
Lines: | 47 |