请输入您要查询的百科知识:

 

词条 Module:User:Mr. Stradivarius/String count
释义 -- This module counts the number of times a string appears on a given page.

local p = {}

local function escapePattern(s)

-- Escape punctuation in a string so it can be used in a Lua pattern.

s = s:gsub('%p', '%%%0')

return s

end

function p.count(frame)

local text = mw.title.new(frame.args.page):getContent()

local pattern = escapePattern(frame.args.search)

local temp, count = mw.ustring.gsub(text, pattern, )

return count

end

return p

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/9/20 15:08:58