base.StringTokenizer.create
Create a string tokenizer object.
Syntax
base.StringTokenizer.create(
str STRING,
delimiters STRING )
RETURNS base.StringTokenizer
- str is the character string to be parsed.
- delimiters defines the delimiters to be used.
Usage
Use the base.StringTokenizer.create()
class method to create a string
tokenizer object.
The 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
Example
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","|+;")
For a complete example, see Example 1: Split a UNIX directory path.