logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtScript functions

substr

Return part of a string

Syntax

[var $... = ]call substr $val=…[;$start=…[;$length=…]][...] optional · ... your value

Notes

Returns the portion of a string specified by the $start and $length parameters.
If $start is negative, the returned string will begin at $start characters from the end of $val.
If $val is less than or equal to $start characters in length, FALSE will be returned.

Example

<!--parser:xtscript-->
var $string = abcdefghijklm
var $portion = call substr $val=$string; $start=4 ; $length=6
print string = $string<br />
print portion = $portion 
<!--/parser:xtscript-->

Copy as text

Output reload

string = abcdefghijklm
portion = efghij

Related

stripos stristr strpos strrchr strripos strrpos strstr

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top