Modul:Str: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
te>Antonsusi K |
te>Antonsusi (+1) |
||
Zeile 26: | Zeile 26: | ||
l = 1 * mw.ustring.len(s) | l = 1 * mw.ustring.len(s) | ||
return mw.ustring.sub(s,1,n-l) | return mw.ustring.sub(s,1,n-l) | ||
+ | end | ||
+ | |||
+ | function Str.hex2dez(frame) | ||
+ | a = tonumber(frame.args[1],16) | ||
+ | if a then | ||
+ | return a | ||
+ | else | ||
+ | return 0 | ||
+ | end | ||
end | end | ||
return Str | return Str |
Version vom 8. Mai 2013, 20:12 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
function Str.crop(frame) s= frame.args[1] n=1*frame.args[2] l = 1 * mw.ustring.len(s) return mw.ustring.sub(s,1,n-l) end
function Str.hex2dez(frame) a = tonumber(frame.args[1],16) if a then return a else return 0 end end
return Str