Siebel eScript Language Reference > Siebel eScript Commands > String Objects >

split() Method


This method splits a string into an array of strings based on the delimiters in the parameter substring.

Syntax

stringVar.split([delimiter])

Parameter
Description

delimiter

The character at which the value stored in stringVar is to be split

Returns

An array of strings, creating by splitting stringVar into substrings, each of which begins at an instance of the delimiter character.

Usage

This method splits a string into an array of substrings such that each substring begins at an instance of delimiter. The delimiter is not included in any of the strings. If delimiter is omitted or is an empty string (""), the method returns an array of one element, which contains the original string.

This method is the inverse of arrayVar.join().

Example

The following example splits a typical Siebel command line into its elements by creating a separate array element at each space character. Note that the string has to be modified with escape characters to be comprehensible to Siebel eScript. Note also that the cmdLine variable must appear on a single line, which space does not permit in this volume. The result appears in the illustration following the example.

function Button3_Click ()
{
   var msgText = "The following items appear in the array:\n\n";
   var cmdLine = "C:\\Siebel\\bin\\siebel.exe /c
\'c:\\siebel\\bin\\siebel.cfg\' /u SADMIN /p SADMIN /d Sample"
   var cmdArray = cmdLine.split(" ");
   for (var i = 0; i < cmdArray.length; i++)
      msgText = msgText + cmdArray[i] + "\n";
   TheApplication().RaiseErrorText(msgText);
}

Running this code produces the following result.

The following items appear in the array:
C:\Siebel\bin\siebel.exe
/c
'C:\siebel\bin\siebel.cfg'
/u
SADMIN
/p
SADMIN
/d
Sample

See Also

join() Method

Siebel eScript Language Reference