Difference between revisions of "MC-Basic:INSTR"
m (Text replace - "''<expression>''" to "<''expression''>") |
|||
Line 14: | Line 14: | ||
''<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. |
''<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 24: | Line 24: | ||
|TYPE= | |TYPE= | ||
''<return value>'': Long<br> | ''<return value>'': Long<br> | ||
− | '' | + | <''expression''>: Long<br> |
''<search_string>'': String<br> | ''<search_string>'': String<br> | ||
''<sub_string>'': String | ''<sub_string>'': String | ||
Line 30: | Line 30: | ||
|RANGE= | |RANGE= | ||
''<return value>'': 0 to MaxLong<br> | ''<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 |
Revision as of 08:04, 17 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