Difference between revisions of "MC-Basic:INSTR"
m (1 revision) |
|||
(8 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Languages|MC-Basic:INSTR}} | ||
{{MC-Basic | {{MC-Basic | ||
|SHORT FORM= | |SHORT FORM= | ||
Line 12: | Line 13: | ||
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. |
− | '' | + | <''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>''. | ''<search_string>'': string expression to be searched for the occurrence of ''<sub_string>''. | ||
Line 23: | Line 24: | ||
|TYPE= | |TYPE= | ||
− | '' | + | <''return value''>: Long<br> |
− | '' | + | <''expression''>: Long<br> |
''<search_string>'': String<br> | ''<search_string>'': String<br> | ||
''<sub_string>'': String | ''<sub_string>'': String | ||
|RANGE= | |RANGE= | ||
− | '' | + | <''return value''>: 0 to MaxLong<br> |
− | '' | + | <''expression''>: 0 to MaxLong<br> |
''<search_string>'': String<br> | ''<search_string>'': String<br> | ||
''<sub_string>'':String | ''<sub_string>'':String | ||
Line 44: | Line 45: | ||
|LIMITATIONS= | |LIMITATIONS= | ||
− | Read | + | Read only |
|EXAMPLE= | |EXAMPLE= | ||
Line 57: | Line 58: | ||
|SEE ALSO= | |SEE ALSO= | ||
− | * [[ | + | * [[MC-Basic:ASC|ASC]] |
− | |||
+ | [[Category:MC-Basic:String Manipulation|INSTR]] | ||
}} | }} |
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