Module:String: Difference between revisions

92 bytes removed ,  11 years ago
Create module
m (fix)
(Create module)
Line 1:
local pstr = {}
 
function p.lengthstr:len( frame )
localreturn arg1 =mw.ustring.len( frame.args[1] )
end
return string.len( arg1 )
end
 
function p.str:sub( frame )
return mw.ustring.sub( frame.args[1], tonumber( frame.args[2] ), tonumber( frame.args[3] ) )
local arg1 = frame.args[1]
end
local arg2 = tonumber( frame.args[2] )
local arg3 = tonumber( frame.args[3] )
if arg2 and arg3 then
local first = arg2 + 1
local last = arg2 + arg3
return string.sub( arg1, first, last )
else
return ""
end
end
 
function str:match( frame )
return p
return mw.ustring.match( frame.args[1], frame.args[2], tonumber( frame.args[3] ) )
end
 
return pstr
Anonymous user