Difference between revisions of "MC-Basic:INSTR"
Line 1: | Line 1: | ||
+ | {{Languages|MC-Basic:INSTR}} | ||
{{MC-Basic | {{MC-Basic | ||
|SHORT FORM= | |SHORT FORM= |
Latest revision as of 08:36, 4 July 2017
Language: | English • 中文(简体) |
---|
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