logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtScript functions

strrchr

Find the last occurrence of a character in a string

Syntax

[var $... = ]call strrchr $haystack=…;$needle=…[...] optional · ... your value

Notes

Returns the part of the $haystack starting at the last occurrence of the $needle until the end of the $haystack

Example

<!--parser:xtscript-->
var $haystack = abcdefghijklm
var $needle = g
  var $portion = call strrchr $haystack=$haystack; $needle=$needle 
print haystack = $haystack<br />
print needle = $needle<br />
print portion = $portion
<!--/parser:xtscript-->

Copy as text

Output reload

haystack = abcdefghijklm
needle = g
portion = ghijklm

Related

stripos stristr strpos strripos strrpos strstr substr

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top