[Include] formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 )
#1

hey,
This is not another number formatter function. With this, you can format any variable type without having to change anything. Before you lose interest, allow me to re-attract your interest by providing a bullet-list!
  • Set the thousand separator (or disable it)
  • Set the number of decimals
  • Set the decimal point
  • Format hex numbers without getting invalid values on high numbers
More information is inside the include.

Examples:
pawn Код:
new
    iNumber = 4864334,
    Float:fFloat = 55548623.112,
    bool:bFalse = false,
    bool:bTrue = true
;

printf( FormatNumber( iNumber ) );
printf( FormatNumber( fFloat, 3, ',', '.' ) );
printf( FormatNumber( bFalse ) );
printf( FormatNumber( bTrue ) );
printf( FormatNumber( fFloat, 0 ) );
printf( FormatNumber( iNumber, 2, 0 ) );
printf( FormatNumber( hex:fFloat ) );
printf( FormatNumber( bit:0b00100110 ) );
printf( FormatNumber( bit_byte:0b10101010101010101010101010101011 ) );
Will print:
Код:
4 864 334
55,548,624.000
false
true
55 548 624
4864334.00
0x4C53E6B4
0b00100110
0b10101010101010101010101010101011
Download!
Reply


Messages In This Thread
formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 19.10.2010, 11:10
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by F_Lexx - 19.10.2010, 12:16
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Scenario - 19.10.2010, 13:06
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 19.10.2010, 13:43
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Seven. - 20.12.2010, 14:33
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by justsomeguy - 21.12.2010, 11:06
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by HyperZ - 21.12.2010, 11:48
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by SWEMike - 09.05.2011, 17:43
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Zh3r0 - 09.05.2011, 18:03
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 09.05.2011, 19:48
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by justsomeguy - 09.05.2011, 20:25
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 10.05.2011, 06:39
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by BASITJALIL - 10.05.2011, 06:50
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Joe Staff - 10.05.2011, 07:49
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by SWEMike - 20.05.2011, 16:51
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by juraska - 20.05.2011, 17:23
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by BoBiTza - 26.05.2011, 15:51
Re : formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Myk3l - 26.05.2011, 19:47
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by aRoach - 27.01.2012, 14:57
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 27.01.2012, 16:57
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by aRoach - 27.01.2012, 17:37
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Blacklite - 29.06.2012, 23:34
Re : formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Islam_Gerland_99 - 11.07.2012, 08:46
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by GoldZoroGrab - 01.07.2013, 12:40
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 01.07.2013, 13:07
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by GoldZoroGrab - 01.07.2013, 13:39
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by GoldZoroGrab - 01.07.2013, 13:46
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Reboma - 30.01.2014, 14:57
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Smileys - 30.01.2014, 19:10
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by minhducc - 08.08.2014, 19:13
Re : Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by anou1 - 13.08.2014, 01:28
Re : formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by anou1 - 13.08.2014, 08:24
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by KayJ - 23.09.2014, 09:36
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Crayder - 25.09.2014, 20:28
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Kar - 29.03.2016, 18:18
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Crayder - 29.03.2016, 18:35
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by Slice - 29.03.2016, 18:44
Re: formatnumber.inc - Human-readable numbers ( 10000000 -> 10 000 000 ) - by rockys - 23.12.2018, 08:17

Forum Jump:


Users browsing this thread: 1 Guest(s)