NXSL:substr

Revision as of 23:23, 2 August 2012 by Victor (talk | contribs) (Created page with "__NOTOC__ Extracts the substring from ''string'' that begins at the ''n''th character and is of length ''len''. == Syntax == substr(''string'', ''n''[, ''len'']); == Para...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Extracts the substring from string that begins at the nth character and is of length len.


Syntax

substr(string, n[, len]);


Parameters

string Source string.
n Starting character index for substring. The n must be a positive whole number. If n is greater than length(string), then empty string is returned.
len Length of substring. If you omit length, the rest of the string is returned.


Return Value

Extracted substring.


Examples

substr("abcdef", 3, 2)		->	"cd"
substr("abcdef", 8)		->	""
substr("abcdef", 4)		->	"def"