יחידה:String: הבדלים בין גרסאות בדף
טל"ח |
מ 16 גרסאות של הדף wikipedia:he:יחידה:String יובאו |
||
| (4 גרסאות ביניים של 2 משתמשים אינן מוצגות) | |||
| שורה 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 | ||
end | end | ||
int = s:match('[^%d.-]*(%-?[%d,]*)') | |||
int = int and string.gsub(int or '', ',', '') | |||
return int or def | |||
end | end | ||
return str | return str | ||