logo
Home XtGem- Templates- XtScript- bottom
XtGemmanual

XtScript functions

stristr

Returns all of $haystack starting from and including the first occurrence of case-insensitive $needle to the end.

Syntax

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

Notes

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)

Example

<!--parser:xtscript-->
var $haystack = abcdefghijklm
var $needle = Hi

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

print After needle<br />
var $position = call stristr $haystack=$haystack; $needle=$needle; $before_needle=0
print haystack = $haystack<br />
print needle = $needle<br />
print position = $position
<!--/parser:xtscript-->

Copy as text

Output reload

Before needle
haystack = abcdefghijklm
needle = Hi
position = abcdefg
After needle
haystack = abcdefghijklm
needle = Hi
position = hijklm

Related

stripos strpos strrchr strripos strrpos strstr substr

XtGem manual · all sections

Powered by XtGem
About us Contact Forum top