Top "Number-formatting" questions

Number formatting is the process of converting a numeric value into a string suitable for display.

Show a number to two decimal places

What's the correct way to round a PHP string to two decimal places? $number = "520"; // It's a string from a database $…

php formatting numbers rounding number-formatting
Format number to always show 2 decimal places

I would like to format my numbers to always display 2 decimal places, rounding where applicable. Examples: number display ------ ------- 1 1.00 1.341 1.34 1.345 1.35 …

javascript floating-point number-formatting
How to convert decimal to hexadecimal in JavaScript

How do you convert decimal values to their hexadecimal equivalent in JavaScript?

javascript hex tostring base number-formatting
java : convert float to String and String to float

How could I convert from float to string or string to float? In my case I need to make the …

java string types number-formatting type-conversion
Write a number with two decimal places SQL server

How do you write a number with two decimal places for sql server?

sql sql-server decimal number-formatting
Using String Format to show decimal up to 2 places or simple integer

I have got a price field to display which sometimes can be either 100 or 100.99 or 100.9, What I want is to …

c# regex string-formatting number-formatting
How to output numbers with leading zeros in JavaScript

I can round to x amount of decimal places with math.round but is there a way to round left …

javascript text-formatting number-formatting
How to format a floating number to fixed width in Python

How do I format a floating number to a fixed width with the following requirements: Leading zero if n < 1 …

python string numbers number-formatting
How to print number with commas as thousands separators?

I am trying to print an integer in Python 2.6.1 with commas as thousands separators. For example, I want to show …

python number-formatting
C# convert int to string with padding zeros?

In C# I have an integer value which need to be convereted to string but it needs to add zeros …

c# formatting number-formatting