Modul:Str: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
te>Antonsusi K |
te>Antonsusi K |
||
Zeile 5: | Zeile 5: | ||
function Str.left(frame) | function Str.left(frame) | ||
− | return mw.ustring.sub(frame.args[1],1,frame.args[2]) | + | return mw.ustring.sub(frame.args[1],1,1*frame.args[2]) |
end | end | ||
function Str.right(frame) | function Str.right(frame) | ||
− | return mw.ustring.sub(frame.args[1],-1*frame.args[2],-1) | + | return mw.ustring.sub(frame.args[1],-1 * frame.args[2],-1) |
end | end | ||
function Str.index(frame) | function Str.index(frame) | ||
− | return mw.ustring.sub(frame.args[1],frame.args[2],frame.args[2]) | + | return mw.ustring.sub(frame.args[1],1*frame.args[2],1*frame.args[2]) |
end | end | ||
function Str.sub(frame) | function Str.sub(frame) | ||
e=frame.args[2]+frame.args[3]-1 | e=frame.args[2]+frame.args[3]-1 | ||
− | return mw.ustring.sub(frame.args[1],frame.args[2],e) | + | return mw.ustring.sub(frame.args[1],1*frame.args[2],e) |
end | end | ||
− | + | return Str | |
− | return Str |
Version vom 7. Mai 2013, 20:40 Uhr
local Str = {} function Str.len(frame) return mw.ustring.len(frame.args[1]) end
function Str.left(frame) return mw.ustring.sub(frame.args[1],1,1*frame.args[2]) end
function Str.right(frame) return mw.ustring.sub(frame.args[1],-1 * frame.args[2],-1) end
function Str.index(frame) return mw.ustring.sub(frame.args[1],1*frame.args[2],1*frame.args[2]) end
function Str.sub(frame) e=frame.args[2]+frame.args[3]-1 return mw.ustring.sub(frame.args[1],1*frame.args[2],e) end return Str