יחידה:String: הבדלים בין גרסאות בדף

טל"ח
ניסוי
שורה 548: שורה 548:
local def = frame.args[2] or ''
local def = frame.args[2] or ''
if not s then return def end
if not s then return def end
local int, frac = s:match('[^%d.]*([%d,]*)(%.%d+)?')
local int, frac = s:match('[^%d.]*([%d,]*)(%.%d+)')
if int or frac then
if int or frac then
int = string.gsub(int or '', ',', '') -- remove commas
int = string.gsub(int or '', ',', '') -- remove commas
frac = frac or ''
frac = frac or ''
return int .. frac
return int .. frac
else
return def
end
end
int = s:match('[^%d.]*([%d,]*)')
int = int and string.gsub(int or '', ',', '')
return int or def
end
end


return str
return str