Search the Community
Showing results for tags 'formatting'.
Found 1 result
Hi there, Today I ran across a problem, I wanted to format different currencies, but due to the lack of inbuilt maths and decent formatting functions and of course most formatting uses scientific notation which is terribly useless for user-end. So I've put together a function, I have only just quickly thrown this together just now, so I have not really bothered to look at ways to optimise it yet and due to limitations, precision is still lost over specific lengths, but it is still ideal for most scenarios, I will take a look into the precision problem at a later date. A few examples: "$" + ([345435.21, 2, ".", ","] call PX_fnc_formatNumber); //Output: $345,435.22 "£" + ([1343345435.21, 2, ".", ","] call PX_fnc_formatNumber); //Output: £1,343,345,408.00 - notice that precion is lost How about the Bulgarian currency (leva)? format["%1%2",([113225.21, 2, ",", " "] call PX_fnc_formatNumber), " лв"]; //Output: 113 225,21 лв And in use: You can grab the function from HERE, meanwhile, if anyone already knows a solution for the precision, please let me know :)