<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

Textoidl/

strtrans.pro

topstrtrans

result = strtrans(InputString, from, to, ned, HELP=HELP)

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 134 2006-07-07 10:19:08Z navarro $ $Log: strtrans.pro,v $ Revision 1.7 2004/06/15 17:25:54 mcraig Fixed bug in regular expression, changed array notation to square brackets Revision 1.6 2004/01/11 01:49:00 mcraig Changed format of one array to newer [] style to avoidf conflict with function name in astro library. Revision 1.5 2001/11/23 21:14:35 mcraig Added keywords /EXTRACT, /PRESERVE_NULL, /REGEX to call to strsplit. This comes very close to reproducing the behavior of the obsolete routine str_sep. Revision 1.4 2001/11/21 19:13:23 mcraig Changed str_sep to strsplit. The former is now considered obsolete by RSI. 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_2_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.

Parameters

InputString       

from       

to       

ned       

Keywords

HELP       

Statistics

McCabe cyclic 8
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.