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

ToBeReviewed/STRING/

strtok.pro

Retrieve portion of string up to token.

topstrtok String

result = strtok(string, token, TRIM=TRIM, HELP=HELP)

Return value

new -- portion of string up to token. out old -- portion of old after token. out, in

Parameters

string        in required

String to be split. Contains text after in, out token on output.

token        in required

Token to use in splitting old.

Keywords

TRIM       

set to remove leading blanks from old before returning.

HELP       

print useful message and exit.

Examples

If old is 'foo44 bar', then strtok( old, '44' ) would return 'foo', and upon return, old will be left with ' bar'. If /TRIM were set, old would be 'bar' on return. not ok ++ IDL> old='foo44 bar' IDL> res=strtok( old, '44' ) IDL> print,res 0 5 IDL> print,old foo44 bar IDL> old='foo44 bar' IDL> res=strtok( old, '44',/TRIM ) IDL> print,res 0 5 IDL> print,old foo44 bar not ok ++ If old='xyz', then new=strtok(old,'a') would return with new='xyz' and old=''. IDL> old='xyz' IDL> new=strtok( old, 'a' ) IDL> print,new 0 IDL> print,old xyz

Version history

Version

$Id: strtok.pro 374 2008-08-08 15:12:27Z pinsard $

History

$Log: strtok.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 Added built in help. Revision 1.1 1996/01/31 18:47:37 mcraig Initial revision Thanks: To D. Linder who wrote GETTOK, part of the goddard library, upon which this is based. 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 distributing this code. This code comes with absolutely NO warranty; see DISCLAIMER for details.

Known issues

Restrictions

Input parameter old is modified. Token may be one or more characters. if token is not found, returns old and sets old to ''.

Statistics

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