2010. március 26., péntek
Formating integers
Problem/Question/Abstract:
How do I format a integer into a nice format. Eg. 1,200,000
Answer:
Lots of people don't realise this, but FormatFloat can be used to format integers as well:
i := 1200000;
s := FormatFloat('#,0', i);
Memo1.lines.add(s);
This will display a formated version of 1200000. If you live in the USA you will get "1,200,000". Depending on the local settings of your Windows environment you might get "1.200.000" (eg you live in The Netherlands). You can also make different formats for negative numbers. Just checkout the Help on FormatFloat.
Feliratkozás:
Megjegyzések küldése (Atom)
Nincsenek megjegyzések:
Megjegyzés küldése