Collaborama About Help Contact Anonymous [login] Source: site.view [edit] Function name: formatNum Arguments: style,value Description: style = USD, Euro, int; value = float Page type: webl Render function: Module: siteutil Page source: var f = ToReal(value) ? value; var res = ""; if Realp(f) then var num = ToString(f); var main = num; var fraction = ""; var i = Str_IndexOf(".", num); if (i > 0) then main = Select(num, 0, i); fraction = Select(num, i+1, Size(num)); if (Size(fraction) == 1) then fraction = fraction + "0" end end; i = 0; while i < Size(main) do i = i + 1; res = Select(main, Size(main) - i, Size(main) - i + 1) + res; if (i mod 3 == 0) and i != Size(main) then res = "," + res; end end; if (fraction != "00" and fraction != "") then res = res + "." + fraction; end; if style == "USD" then res = "$" + res end; if style == "Euro" then res = "" + res end; else res = f; end; res;