Split function (LotusScript® Language)

Returns an Array of Strings that are the substrings of the specified String.

Note: This function is new with Domino® Release 6.

Syntax

Split ( expression [, delimiter [, count [, compMethod ]]])

Elements

expression

The scalar String to be split into its substrings

delimiter

An optional scalar String containing the characters to separate substrings. If delimiter is not specified, then the space character " " is used

count

An Integer specifying the number of substrings to return. The default value of -1 indicates that all substrings are returned.

compMethod

An Integer specifying the type of comparison to use when searching for the delimiter.

Number

Comparison method

0

Case Sensitive, Pitch sensitive

1

Case Insensitive, Pitch sensitive

4

Case Sensitive, Pitch insensitive

5

Case Insensitive, Pitch insensitive

Use 2 to specify string comparison in the platform's collation sequence. If 2 is specified, strings are compared bit-wise. If you omit compMethod, the default comparison mode is the mode set by the Option Compare statement for this module. If there is no statement for the module, the default is case-sensitive and pitch-sensitive.

Return value

Split returns an Array of Strings. Each element of this array contains a substring found in expression.

Usage

Split parses expression into substrings consisting of text delimited by the separator character (or the beginning or end of the String), and not containing the separator character. These substrings are placed into an Array in order, and the Array is returned.

Whitespace is not trimmed. Carriage returns are not trimmed and do not cause separations.

If the number of results specified is greater than the number of actual results, the returned Array will equal the number of actual results

If the number of results specified is less than the number of actual results, the last element of the array returned will contain the remainder of the string. For example,

split("this is a test", " ", 2) 

would return an array with element 0 = "this", 1 = "is a test"

If count is < -1, a RunTime Arg Out of Range error is thrown.

If count is 0, Split returns an array of size 0 with lbound 0 and ubound -1.

Error Handling:

Split will throw a Runtime Type Mismatch if either the expression or the delimiter is not scalar.

Split will throw a Runtime Argument Out of Range error if count is < -1 or optcompare is an invalid value.

Example