Find string in string as whole word

Syntax

int findw(string substring [from] [delim] [flags])

 

Parameters

string - string to search in.

substring - word to find.

from - 0-based character index, from which to start search. Default 0.

delim - delimiters.

flags:

1 Case insensitive.
64 QM 2.3.3. Match always if substring begins/ends with a delimiter.
0x100 delim is table of delimiters.
0x200 QM 2.3.3. Add blanks to delim.

 

Remarks

Returns 0-based index of first character of substring in string. If not found, returns -1. Searches substrings delimited by characters in delim.

 

Tips

If string can be multiline, don't forget to include line break characters ( [] ) in delim. Or flag 0x200.

 

See also: findrx.

 

Example

str s = "my.exe /p"
int i = findw(s "exe" 0 " .:\/''[]")
out i ;;3