Purpose
Get a substring
of a string.
Synopsis
function substr(str:string, i1:integer, i2:integer):string
Arguments
str
|
String
|
i1
|
Starting position of the substring
|
i2
|
End position of the substring
|
Return value
Substring of the given string.
Example
write(substr("Example text", 3, 10))
This outputs the text: ample te
Further information
This function returns the substring from the i1th to the
i2th character of a given string (the counting starts from 1). This function returns an empty string if the bounds are not compatible
with the string (e.g. starting position larger than the length of the string) or inconsistent (e.g. starting position after end position).
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.