base.StringTokenizer.createExt

Create a string tokenizer object with escape char and null handling.

Syntax

base.StringTokenizer.createExt(
   source STRING, delims STRING,
   escape STRING, nulls BOOLEAN )
  RETURNING result base.StringTokenizer
  1. source is the character string to be parsed.
  2. delims defines the delimiters to be used.
  3. escape defines the escape character.
  4. nulls indicates if empty tokens must be returned.

Usage

Use the base.StringTokenizer.createExt() class method to create a string tokenizer object, with escape character and null token handling.

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.

When defining an escape character with the third parameter, the delimiters can be escaped in the source string.

When passing TRUE to the last parameter, the empty tokens are taken into account. The nextToken() method might return NULL strings. In the source string, leading and trailing delimiters or the amount of delimiters between two tokens affects the number of tokens.

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
LET tok = base.StringTokenizer.createExt("|aaa||b\\|bb|ccc","|","\\",TRUE)