Module:String2: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
allow split to use negative indices
(store just the string)
(allow split to use negative indices)
Line 115:
local plain = (args[4] or args.plain or "true"):sub(1,1)
plain = (plain ~= "f" and plain ~= "n" and plain ~= "0")
returnlocal splittbl = mw.text.split( txt, sep, plain )[idx]
if idx < 0 then idx = #splittbl + idx + 1 end
return splittbl[idx]
end
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu