STRSPLIT Function

Splits a string into an array of substrings called tokens.

Usage

tokens = STRSPLIT(string, pattern)

Input Parameters

string—The scalar string that is scanned and split into tokens.

pattern—A scalar string specifying a regular expression. This regular expression is the delimiter used to determine where to split the string.

Returned Value

tokens—A string array of substrings.

Keywords

None.

Discussion

STRSPLIT uses regular expressions, not wildcard characters, for pattern matching. To use STRSPLIT, it is crucial that you understand regular expressions. For a detailed discussion of regular expressions, see the PV‑WAVE Programmer’s Guide.

Example

In this example, a string containing a colon (:) separated list of directories is split into a string array of directories.

path = '/bin:/usr/bin:/usr/local/bin:/etc:/usr/ucb/bin'
dirs = STRSPLIT(path, ':')
PRINT, dirs, Format='(A)'
; PV-WAVE prints the following:
; /bin
; /usr/bin
; /usr/local/bin
; /etc
; /usr/ucb/bin

See Also

STRJOIN, STRMATCH

For detailed information, see the PV‑WAVE Programmer’s Guide.