[an error occurred while processing this directive]
 | Forms Processor Advanced Commands |
Contents
Index of Commands
Search the Forms Processor Docs
indexThe index command returns the numeric offset into the source string of the string or character you are searching for.
- index($haystack,"needle",[begin]);
-
- $haystack - The source data you are searching through, usually it is a file that has been slurped into a variable.
- needle - The string or character you are searching for.
- begin - An optional offset into the source string at which the index command starts searching.
Example:
#find a colon in the string:
# 'somename:age'
$haystack="Joe Blow:37";
$offset = index($haystack,":");
$name = substr($haystack,0,$offset);
$age = substr($haystack,$offset+1,length($haystack)-$offset);
format screen
$name you are $age years old!
.
See also: substr ($string, start, length) function length($string) function
[an error occurred while processing this directive]