2℃
刚才写一个lua上实现php中的strpos()函数,下面在来个strrpos()函数,查找某个字符串在指定字符串最后一次出现的位置,下面我们还是简单写一下函数,代码如下:
function strrpos (str, f)
if str ~= nil and f ~= nil then
local t = true
local offset = 1
local result = nil
while (t)
do
local tmp = string.find(str, f, offset)
if tmp ~= nil then
offset = offset + 1
...
lua, php, string, strrpos阅读全文