%FindStr function


Old name
%InStr


Function
The function searches for occurrence of a subtext in a text.


Declaration
INT %FindStr(
   TEXT in text, 
   TEXT in subText,
   BOOL in direction := @TRUE,
   INT	in fromIdx := 1
 )
Parameters
textText, which is to be searched.
subTextText to search.
direction@TRUE - searching from the text beginning.
@FALSE - searching from the text end.
fromIdxStarting position of substring search.
Example
The function will return the index of the occurrence of the 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.
 


 %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
Napíšte komentár