Programmer Guide/Command Reference/STRCHR: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
==STRCHR==
<var>var</var> := STRCHR [ /Reverse ] [ [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]] ] [ /V ] /- <var>characters</var> <var>string</var>
<var>var</var> := STRCHR [ /Reverse ] [ [[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]] /V /- <var>characters</var> <var>variable</var>


<code><var>var</var> := STRCHR [ /R ] [ /S ] [ /V ] /- <var>characters</var> <var>string</var></code>
Locates the first occurrence of the character <var>character</var>, or one of the characters in <var>characters</var> in the string <var>string</var> or the variable <var>variable</var>. and returns the index of the first occurrence, or -1, if no occurrence is found.
 
<code><var>var</var> := STRCHR [ /R ] [ /S ] /V /- <var>characters</var> <var>variable</var></code>
 
-> var = the index of the first occurrence or -1
 
Locates the first occurrence of the character <var>character</var>, or one of the characters in <var>character</var> in the string <var>string</var> or the variable <var>variable</var>. and returns the index of the first occurrence, or -1, if no occurrence is found.
 
;<var>/R</var>
 
:If option /R is supplied, the string will be searched from right to left; otherwise, it will be searched from left to right.
 
;<var>/S</var>
 
:If option /S is set, warnings instead of errors will be generated on failure


;<code>/Reverse</code>
:If option <code>/Reverse</code> is supplied, the string will be searched from right to left; otherwise, it will be searched from left to right.
;<code>[[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]</code>
:If option <code>[[Programmer_Guide/Command_Reference_Options/Silent|/Silent]]</code> is set, warnings instead of errors will be generated on failure
;<var>string</var>
;<var>string</var>
:A string of characters to search for.
:A string of characters to search for.
;<var>character</var>
;<var>character</var>
:A single character to search for.
:A single character to search for.
;<var>variable</var>
;<var>variable</var>
:Find the first semi-colon in the string stored in the variable <var>variable</var>.


Find the first semi-colon in the string stored in the variable #v.
#v := set 'You must be joking ;-)'
 
#i := strchr /v /- ';' '#v'
<pre>
// #i == 19
#v := set 'You must be joking ;-)'
#i := strchr /v /- ';' '#v'
// #i == 19
</pre>

Revision as of 18:42, 29 April 2014

var := STRCHR [ /Reverse ] [ /Silent ] [ /V ] /- characters string
var := STRCHR [ /Reverse ] [ /Silent] /V /- characters variable

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

/Reverse
If option /Reverse is supplied, the string will be searched from right to left; otherwise, it will be searched from left to right.
/Silent
If option /Silent is set, warnings instead of errors will be generated on failure
string
A string of characters to search for.
character
A single character to search for.
variable
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

Navigation menu

Personal tools