base.StringTokenizer.create

Create a string tokenizer object.

Syntax

base.StringTokenizer.create(
   source STRING,
   delims STRING )
  RETURNING result base.StringTokenizer
  1. source is the character string to be parsed.
  2. delims defines the delimiters to be used.

Usage

Use the base.StringTokenizer.create() class method to create a string tokenizer object.

The new created object must be assigned to a program variable defined with the base.StringTokenizer type.

The method can take a unique or multiple delimiters into account. A delimiter is always one character long.

The empty tokens are not taken into account, and no escape character is defined for the delimiters. The nextToken() method will never return NULL strings.

Note: To specify a backslash as a delimiter, you must use double backslashes in both the source string and as the delimiter, as shown in Example 3: Specify a backslash as a delimiter
DEFINE tok base.StringTokenizer
-- Using a single pipe delimiter
LET tok = base.StringTokenizer.create("aaa|bbb|ccc","|")
-- Using several delimiters
LET tok = base.StringTokenizer.create("aaa|bbb;ccc+ddd","|+;")