.-
help for ^strparse^
.-

Parse string variables ----------------------

^strparse^ strvar [^if^ exp] [^in^ range] , ^g^enerate^(^stub^)^ [ ^p^arse^(^parsestr^) noTrim^ ]

Description -----------

^strparse^ parses a string variable into one or more string variables based on a parsing character, by default blank space(s). It is useful for separating words in a string variable, although parsing can be done using any substring, not just spaces.

Options -------

^generate(^stub^)^ is not optional. It specifies the beginning characters of the new variable names: stub^1^, stub^2^, etc.

^parse(^parsestr^)^ specifies that, instead of spaces, parsing should be done using parsestr. For example, if ^parse(,)^ is specified then ^"1,2,3"^ becomes three string variables with values ^"1"^, ^"2"^ and ^"3"^ > . parsestr may be more than one character: if so, the entire sequence is used as one, not as separate parsing characters.

^noTrim^ specifies that the original string var should not be trimmed of leading and trailing spaces before being parsed.

Examples --------

. ^strparse name, gen(nameN)^

applied to ^"John Smith"^ creates ^nameN1^ = ^"John"^ and ^nameN2^ = ^"Smit > h"^

. ^strparse stuff, gen(junk) parse(X/)^

^"abcX/def"^ becomes ^junk1^ = ^"abc"^ and ^junk2^ = ^"def"^ ^"abc X / def"^ becomes ^junk1^ = ^"abc X / def"^

Authors -------

Michael Blasnik mblasnik@@110.net

Nicholas J. Cox, University of Durham, U.K. n.j.cox@@durham.ac.uk