Porovnávané verzie
porovnané s
Kľúč
- Tento riadok sa pridal
- Riadok je odstránený.
- Formátovanie sa zmenilo.
%FindStr function
Old name
%InStr
Function
The function searches for occurrence of a subtext in a text.
Declaration
Blok kódu | ||||
---|---|---|---|---|
| ||||
INT %FindStr( TEXT in text, TEXT in subText, BOOL in direction := @TRUE, INT in fromIdx := 1 ) |
Parameters
text | Text, which is to be searched. |
subText | Text to search. |
direction | @TRUE - searching from the text beginning. @FALSE - searching from the text end. |
fromIdx | Starting position of substring search. |
Example
The function will return the index of the occurrence of the text subText from subText in parameter text from the beginning, if the parameter direction is not entered, or gets the value @TRUE. If the parameter direction gets value @FALSE, the search is executed from the end. With the fromIdx parameter, you can specify the index, from where the subText parameter will be searched. If the fromIdx parameter exceeds the total length of the text parameter, the function returns an undefined value. If the search is not successful, the function returns the value 0.
Blok kódu | ||||
---|---|---|---|---|
| ||||
%FindStr("text some text", "text") ; returns the value of 1 %FinsStr("text some text", "text", @TRUE) ; returns the value of 1 %findStr("text some text", "text", @FALSE) ; returns the value of 13 %findStr("text some text", "text", @TRUE, 2) ; returns the value of 13 |