Returns a substring from string from a specified field index number
Class: String
Parameters: $string – The string to be searched
index – The field index number
$delimiter (Optional) – The field delimiting character or characters
Syntax: $substring=$field($string, index [,$delimiter])
Returns:
• If 0<index≤no of fields – The substring of index in $string as a string
• If index≤0 or index>no of fields – 0
Remarks: $delimiter defaults to “,” (comma)
Example:
//Example for the string $field method
$s=”05/01\67” //Set string
fieldindex=2 //Set field index number
$d=”/\” //Set delimiters
$sub=$field($s, fieldindex, $d) //Result (= ‘01’)
message(“Sub string at field index “ + fieldindex + “ is “ + $sub) //Display results message
See Also: field