2Hi.Biz
Trang chủ
|
TWIG
|
Xtscript
|
Templates
|
Xtgem
Functions Xtscript
AiChat.Wap.Sh
strripos
Tìm vị trí của sự xuất hiện cuối cùng của một chuỗi con trong một chuỗi
[...] = optional ... = your value[var $... = ]call strripos $haystack=…;$needle=…[;$offset=…]
Code ví dụ:
<!--parser:xtscript-->
# Needle is at positions 2 and 15
var $haystack = abcdefghijklmabcdefghijklm
var $needle = CDE
var $offset = 0
var $position = call strripos $haystack=$haystack; $needle=$needle; $offset=$offset ;
print haystack = $haystack<br />
print needle = $needle<br />
print offset = $offset<br />
print position = $position<hr />
var $offset = -12
var $position = call strripos $haystack=$haystack; $needle=$needle; $offset=$offset ;
print haystack = $haystack<br />
print needle = $needle<br />
print offset = $offset<br />
print position= $position<hr />
<!--/parser:xtscript-->
<!--parser:xtscript--> # Needle is at positions 2 and 15 var $haystack = abcdefghijklmabcdefghijklm var $needle = CDE var $offset = 0 var $position = call strripos $haystack=$haystack; $needle=$needle; $offset=$offset ; print haystack = $haystack<br /> print needle = $needle<br /> print offset = $offset<br /> print position = $position<hr /> var $offset = -12 var $position = call strripos $haystack=$haystack; $needle=$needle; $offset=$offset ; print haystack = $haystack<br /> print needle = $needle<br /> print offset = $offset<br /> print position= $position<hr /> <!--/parser:xtscript-->
Code đã chạy:
haystack = abcdefghijklmabcdefghijklm
needle = CDE
offset = 0
position = 15
haystack = abcdefghijklmabcdefghijklm
needle = CDE
offset = -12
position= 2