Jump to content

Module:Vespertviro10000/tst

From Wikipedia

Documentation for this module may be created at Module:Vespertviro10000/tst/doc

local p = {}

function p.countSubstring( mainString, subString )
	local tab = mw.text.split(mainString, subString, true)
    return table.getn(tab) - 1
end

function p.countSubstringInPage( frame )
	local sub_text = frame.args[ 1 ] or ''
	local pageName = frame.args[ 2 ] or ''
	local title=mw.title.makeTitle( "", pageName )

    return p.countSubstring(title:getContent(),sub_text)
end

return p