split

Description

The split() function creates a list from a string. The string is broken up into separate list elements based on the characters in the specified delimiter string. If a delimiter string is not specified, then a string containing space, tab (\t), and newline (\n) is used. If none of the delimiter characters are encountered, then a list that contains one element (that is, the entire string) is returned.

Syntax

result = split (string1[,delimiter[,omit_empty_elements]]);

Arguments

string1 Required. The string to separate into list elements.
delimiter Optional. The delimiter string that is used to break the string into separate elements. If delimiter is not specified, then \t\n is used as the delimiter string.
omit_empty_elements Optional. Boolean value that determines whether empty elements of the resulting list are omitted (true) or included (false). If omit_empty_elements is not specified, it defaults to true.

Return Values

result contains the new list.

UserList = "user1,user2,user3,,user4";
result = split (UserList,",");

In this example, result contains the following list:

{"user1", "user2", "user3", "user4"}
UserList = "user1,user2,user3,,user4";
result = split (UserList,",",false);

In this example, result contains the following list:

{"user1", "user2", "user3", "", "user4"}

For more information, see the following: