logo
Home XtGem- Templates- XtScript- bottom
Find the position of the first occurrence of a substring in a string
[...] = optional ... = your value
[var $... = ]call strpos $haystack=…;$needle=…[;$offset=…]
negative $offset values do not work
Show in textarea
<!--parser:xtscript-->
var $haystack = abefcdefghijklmnopqrstuvwxyz
var $needle = op
var $offset = 0
var $position = call strpos $haystack=$haystack; $needle=$needle; $offset=$offset ;
print haystack = $haystack<br />
print needle = $needle <br />
print offset = $offset <br />
print position = $position
<!--/parser:xtscript-->
Show in textarea
Reload
haystack = abefcdefghijklmnopqrstuvwxyz
needle = op
offset = 0
position = 16
Powered by XtGem
About us Contact Forum top