Jump to content

Module:String

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tim Starling (talk | contribs) at 00:15, 21 February 2013 (have sub return more than one character (broken by ID 538979768)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

local str = {}

function str.len( frame )
    return mw.ustring.len( frame.args.s )
end

function str.sub( frame )
    return mw.ustring.sub( frame.args.s, tonumber( frame.args.i ), tonumber( frame.args.j ) )
end

function str.match( frame )
    return mw.ustring.match( frame.args.s, frame.args.pattern, tonumber( frame.args.i ) )
end

return str