[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]


REPSTR Source code in repstr.pro

REPSTR

Name
       REPSTR
Purpose
       Replace all occurences of one substring by another.
Explanation
       Meant to emulate the string substitution capabilities of text editors
Calling Sequence
       result = repstr( obj, in, out )
Input Parameters
       obj    = object string for editing, scalar or array
       in     = substring of 'obj' to be replaced, scalar
Optional Input Parameters
       out    = what 'in' is replaced with, scalar.   If not supplied
               then out = '', i.e. 'in' is not replaced by anything.
Output Parameters
       Result returned as function value.  Input object string
       not changed unless assignment done in calling program.
Procedure
       Searches for 'in', splits 'obj' into 3 pieces, reassembles
       with 'out' in place of 'in'.  Repeats until all cases done.
Example
       If a = 'I am what I am' then print,repstr(a,'am','was')
       will give 'I was what I was'.
Revision History
       Written by Robert S. Hill, ST Systems Corp., 12 April 1989.
       Accept vector object strings, W. Landsman   HSTX,   April, 1996
       Converted to IDL V5.0   W. Landsman   September 1997
       Convert loop to LONG, vectorize STRLEN call W. Landsman June 2002
       Correct bug in optimization, case where STRLEN(OBJ) EQ
         STRLEN(IN), C. Markwardt, Jan 2003
       Fixed problem when multiple replacements extend the string length
                 D. Finkbeiner, W. Landsman  April 2003
       Allow third parameter to be optional again W. Landsman  August 2003
       Remove limitation of 9999 characters, C. Markwardt Dec 2003

Last modified by pro2html on 2003 December 16 at 05:51 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically