From STX Wiki
Jump to navigation Jump to search
var := STRCHR [ /Reverse ] [ /Silent ] /- needle haystackstring
var := STRCHR [ /Reverse ] [ /Silent] /Variable /- needle haystackvariable

Locates the first occurrence of the character character, or one of the characters in characters in the string haystackstring or, if /Variable is supplied, in the variable haystackvariable. and returns the index of the first occurrence, or -1, if no occurrence is found.

If option /Reverse is supplied, the haystack will be searched from right to left; otherwise, it will be searched from left to right.
If option /Silent is set, warnings instead of errors will be generated on failure
This option tells STx that the haystack argument is the name of a variable whose contents are to be searched. When omitting /Variable, the haystack argument will be considered a string literal to search.
The "end of options" option tells STx that any further arguments are plain arguments, even should they start with a slash. You should always use this option in order to prevent - unless, of course, if you can be entirely sure that none of your arguments will start with a slash.
A string of characters, or a single character, to search for.
Find the first semi-colon in the string stored in the variable variable.
#v := set 'You must be joking ;-)'
#i := strchr /v /- ';' '#v'
// #i == 19