logo
Home XtGem- Templates- XtScript- bottom
Returns all of $haystack starting from and including the first occurrence of $needle to the end.
[...] = optional ... = your value
[var $... = ]call strstr $haystack=…;$needle=…[;$before_needle=…]
Returns the part of $haystack starting from and including the first occurrence of $needle to the end of $haystack
If $before_needle=1 the function returns the part of $haystack before the first occurrence of $needle (excluding $needle)
Show in textarea
<!--parser:xtscript-->
var $haystack = abcdefghijklm
var $needle = g

var $position = call strstr $haystack=$haystack; $needle=$needle; $before_needle=1 ;
print haystack = $haystack<br />
print needle = $needle<br />
print position = $position<hr />

var $position = call strstr $haystack=$haystack; $needle=$needle; $before_needle=0 ;
print haystack = $haystack<br />
print needle = $needle<br />
print position = $position
<!--/parser:xtscript-->
Show in textarea
Reload
haystack = abcdefghijklm
needle = g
position = abcdef
haystack = abcdefghijklm
needle = g
position = ghijklm
Powered by XtGem
About us Contact Forum top