模块:StringTPC:修订间差异
外观
Harry00025(留言 | 贡献) 无编辑摘要 |
Harry00025(留言 | 贡献) 小 Harry00025移动页面模块:Split至模块:StringTPC |
(没有差异)
| |
2026年5月16日 (六) 09:17的版本
此模块的文档可以在模块:StringTPC/doc创建
-- 本模块使用deepseek生成,Harry00025复核 26/5/16
local p = {}
p.a = function(frame)
local A = frame.args[1]
local B = frame.args[2]
local count = 0
local pos = 1
-- 使用 string.find 循环查找
while pos <= #A do
local start_pos, end_pos = string.find(A, B, pos, true) -- true 表示纯文本匹配
if start_pos then
count = count + 1
pos = end_pos + 1 -- 移动到匹配结束后的位置(不重叠)
else
break
end
end
return count
end
return p