יחידה: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
שורה 554: שורה 554:
return int .. frac
return int .. frac
end
end
int = s:match('[^%d.]*(-?[%d,]*)')
int = s:match('[^%d.-]*(%-?[%d,]*)')
int = int and string.gsub(int or '', ',', '')
int = int and string.gsub(int or '', ',', '')
return int or def
return int or def