Compare beginning, end or middle

Syntax

int s.beg(string [lens])
int s.begi(string [lens])
int s.end(string [lens])
int s.endi(string [lens])
int s.mid(string from [lens])
int s.midi(string from [lens])

 

Parameters

s - str variable.

string - string to compare with.

lens - number of characters to compare. Default: -1 (function itself finds string length).

from - 0-based character index in s from where to begin comparison.

 

Remarks

beg returns 1 if s begins with string, or 0 if not.

end returns 1 if s ends with string, or 0 if not.

mid returns 1 if s contains string at from position, or 0 if not.

 

begi, endi and midi perform case insensitive comparison.

 

Example

str s = "Edit\Copy"
if(s.beg("Edit")) out "True"; else out "False"
if(s.midi("cop" 5)) out "True"; else out "False"