Difference between revisions of "MC-Basic:INSTR"

From SoftMC-Wiki
Jump to: navigation, search
m (Text replace - "Read-Only" to "Read only")
m (Text replace - "''<return value>''" to "<''return value''>")
Line 12: Line 12:
 
Returns the position of the starting character of a substring in a string.
 
Returns the position of the starting character of a substring in a string.
  
''<return value>'': character position in ''<search_string>'' where ''<sub_string>'' begins. If ''<sub_string>'' does not occur within ''<search_string>'', a value of 0 is returned.
+
<''return value''>: character position in ''<search_string>'' where ''<sub_string>'' begins. If ''<sub_string>'' does not occur within ''<search_string>'', a value of 0 is returned.
  
 
<''expression''>:optional expression indicating the position of the character within ''<search_string>'' where searching is to begin. If omitted, the searching starts at the first character.
 
<''expression''>:optional expression indicating the position of the character within ''<search_string>'' where searching is to begin. If omitted, the searching starts at the first character.
Line 23: Line 23:
  
 
|TYPE=
 
|TYPE=
''<return value>'': Long<br>
+
<''return value''>: Long<br>
 
<''expression''>: Long<br>
 
<''expression''>: Long<br>
 
''<search_string>'': String<br>
 
''<search_string>'': String<br>
Line 29: Line 29:
  
 
|RANGE=
 
|RANGE=
''<return value>'': 0 to MaxLong<br>
+
<''return value''>: 0 to MaxLong<br>
 
<''expression''>: 0 to MaxLong<br>
 
<''expression''>: 0 to MaxLong<br>
 
''<search_string>'': String<br>
 
''<search_string>'': String<br>

Revision as of 09:35, 20 March 2014

Returns the position of the starting character of a substring in a string.

<return value>: character position in <search_string> where <sub_string> begins. If <sub_string> does not occur within <search_string>, a value of 0 is returned.

<expression>:optional expression indicating the position of the character within <search_string> where searching is to begin. If omitted, the searching starts at the first character.

<search_string>: string expression to be searched for the occurrence of <sub_string>.

<sub_string>: string expression containing the <sub_string> to be searched for within the <search_string>.

If one of the input strings is of UTF-8 type and the other is not, the code of the non-UTF-8 input string will be implicitly converted to the UTF-8 codingmethod.

Syntax

INSTR({<expression>},<search_string>,<sub_string>)

Availability

All versions

Type

<return value>: Long
<expression>: Long
<search_string>: String
<sub_string>: String

Range

<return value>: 0 to MaxLong
<expression>: 0 to MaxLong
<search_string>: String
<sub_string>:String

Scope

Configuration, Task or Terminal

Limitations

Read only

Examples

?INSTR("file ", ".")
       0

?INSTR("file.exe", "exe")
       6

?INSTR(7,"1-2-3-4-5-6", "-")
       8

See Also