Find and get n-th token (part) of other string

Syntax

int s.gett(ss [n] [delim] [flags])

 

Parameters

s - str variable.

ss - source string.

n - 0-based index of token. Default: -1.

delim - delimiters.

flags:

2 Get all right part.
0x100 delim is table of delimiters.
0x200 QM 2.3.3. Add blanks to delim.

 

Remarks

Gets n-th token (substring delimited by characters in delim) from ss. Returns 0-based index of first character of the token. If there are less than n+1 tokens in ss, returns -1.

 

If n is omitted or negative, finds next token. It works in same function only.

 

Tip: to get lines, use getl.

See also: findt findrx

 

Examples

 get the second token
str s = "my.exe /cl"
str st.gett(s 1 " .:\/''[]")
out st

 for each word
int t
for t 0 1000000000
	if(st.gett(s -t)<0) break
	out st