Seiki Batch Script > String Functions

field

Reports the field index position as an integer of a specified string within a string

Class: String

Parameters:  $string – The string to be searched

                     $search – The search string

                     $delimiter (Optional) – The field delimiting character or characters

Syntax: index=field($string, $search [,$delimiter])

Returns:

•      If $search is found – The field index of $search in $string as an integer

•      If $search is not found – 0

Remarks:

•      $delimiter defaults to “,” (comma)

•      Search criteria is case insensitive

Example:

//Example for the string field method

$s=”05/01\67” //Set string

$srch=”01” //Set search string

$d=”/\” //Set delimiters

idx=field($s, $srch, $d) //Result (= 2)

message(“Search string “ + $srch + “ found at index “ + idx) //Display results message

 

See Also:    $field