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