Phantom Documentation

[Help Home] [Phantom Home]
split
string split(string,string)

Return Type: string
Parameters: string input, string token

Description:

This function takes an input string and divides it into an array of strings using the token input as a delimeter. It is the same as searching for the delimeter in a string and using the result to perform a substring to extract out the strings between the delimeters. The input can be any number of characters. The return value is a one-dimensional array containing the resulting strings. The token is not included in the output. If no token is found, the input string is returned.

Example Code
1 >>string input = "bee:=sing:=phantom:=user:=foo:=house";
2 >>string words = split(input, ":");
3 >>disp(size(words));
6
4 >>disp(words);
bee
=sing
=phantom
=user
=foo
=house
5 >>words = split(input, ":=");
6 >>disp(size(words));
6
7 >>disp(words);
bee
sing
phantom
user
foo
house
8 >>words = split(input, "+");
9 >>disp(size(words));
1
10 >>disp(words);
bee:=sing:=phantom:=user:=foo:=house



Copyright 2000-2011 Phantom Automated Solutions