Find and get n-th line of other string

Syntax

int s.getl(ss [n] [flags])

 

Parameters

s - str variable.

ss - source string.

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

flags:

2 get all right part.

 

Remarks

Gets n-th line from ss. Returns 0-based index of first character of the line in ss. If there are less than n+1 lines in ss, returns -1.

 

If n is omitted or negative, gets next line. It works in same function only.

 

See also: findl, numlines, foreach, line break characters

 

Example

str s ss="one[]two[][]four[]"
int i
for i 0 2000000000
	if(s.getl(ss -i)<0) break ;;no more
	if(s.len=0) continue ;;skip empty
	out s