Seiki Batch Script > String Functions

token

Splits the specified string containing substrings separated by a specified string into a 1-dimensional string array. Returns the number of elements in the string array

Class: String

Parameters:  $string – The string containing the substrings

                     $array – String array

$sep (Optional) – String to be used for the separator character(s). Default $sep is comma character

$quote (Optional) – String to be used as the quotation. Must embody $sep if used. Default $quote is double quote

d (Optional) – Integer value setting to keep leading and trailing spaces (value 0) or not (value 1)

Syntax: returnValue=token($array [,$sep [,$quote [,d]]])

Returns: The number of elements of $array

Remarks: Returns -1 if $array is not one-dimensional

Example:

//Example for the string $left method

array $MyArray //Declare 1 dimensional string array

$s=”A;B;C” //Set string

result=token($s, $MyArray, “;”) //Result (=3)

message(“Number of elements in “ + $s + “ is “ + result) //Display results message