NAME:
STRTRANS
PURPOSE:
Translate all occurences of one substring to another.
CATEGORY:
text/strings
CALLING SEQUENCE:
new = strtrans(oldstr,from,to,ned)
INPUTS:
oldstr -- string on which to operate. in
May be an array.
from -- substrings to be translated. May be in
an array.
to -- what strings in from should be in
translated to. May be an array.
KEYWORD PARAMETERS:
/HELP -- Set this to print useful message and
exit.
OUTPUTS:
new -- Translated string. Array if oldstr is out
an array.
ned -- number of substitutions performed in out
oldstr. Array if oldstr is an array.
COMMON BLOCKS:
SIDE EFFECTS:
NOTES:
- Any of old, from, and to can be arrays.
- from and to must have the same number of elements.
EXAMPLE:
inp='Many*bad!chars+in_here'
from=['*','!','+','_']
to =[' ',' ',' ',' ']
out = strtrans(inp,from,to,ned)
Will produce out='Many bad chars in here', and set ned to 4.
MODIFICATION HISTORY:
$Id: strtrans.pro 18 2006-05-02 09:32:05Z pinsard $
$Log: strtrans.pro,v $
Revision 1.3 1996/06/14 20:00:27 mcraig
Updated Copyright info.
Revision 1.2 1996/05/09 00:22:17 mcraig
Sped up significantly by using str_sep to handle the translation. No longer
relies on routines fromother user libraries.
Revision 1.1 1996/01/31 18:47:37 mcraig
Initial revision
RELEASE:
$Name: Rel_1_2 $
COPYRIGHT:
Copyright (C) 1996 The Regents of the University of California, All
Rights Reserved. Written by Matthew W. Craig.
See the file COPYRIGHT for restrictions on distrubting this code.
This code comes with absolutely NO warranty; see DISCLAIMER for details.