Module:String2: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
upgrade posnq - Now supports named parameters: source, target, plain, nomatch; and UTC
(don't trim the separator)
(upgrade posnq - Now supports named parameters: source, target, plain, nomatch; and UTC)
Line 110:
-- any double quotes " are stripped out.
p.posnq = function(frame)
local str = mw.text.trim(frame.args[1] or frame.args.source or "")
local match = mw.text.trim(frame.args[2] or frame.args.target or ""):gsub('"', '')
local plain = mw.text.trim(frame.args[3] or frame.args.plain or "")
if plain == "false" then plain = false else plain = true end
local nomatch = mw.text.trim(frame.args[4] or frame.args.nomatch or "")
if str == "" or match == "" then return nil end
-- just take the start position
local pos = str:mw.ustring.find(str, match, 1, trueplain) or nomatch
return pos
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu