SA-MP Forums Archive
Human readable numbers - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Human readable numbers (/showthread.php?tid=500674)



Human readable numbers - Dj_maryo1993 - 14.03.2014

There was a function that made a number into a string , delimiting each 3 digits with a dot (.)

For example

1500 will turn intro 1.500 || 15000 will tun into 15.000

Can any1 give me this function ?


Re: Human readable numbers - MP2 - 14.03.2014

It should be commas, not periods.

https://www.******.co.uk/search?q=samp+number+commas


Re : Human readable numbers - Golimad - 14.03.2014

pawn Code:
stock Comma(numbers)
{
    new temp[24],counter = -1;
    valstr(temp,numbers);
    for(new i = strlen(temp);i > 0; i--)
    {
        counter++;
        if(counter == 3)
        {
            strins(temp,",",i);
            counter = 0;
        }
    }
    return temp;
}
Use this to a number to put dots ..
pawn Code:
Comma(WhateverNumbers);



Re: Human readable numbers - Dj_maryo1993 - 14.03.2014

Ty ,it works


Re: Human readable numbers - CuervO - 14.03.2014

Officially "Human readable numbers" (which by the way is an awful name to give to unseparated numbers, because they are readable by most of the people) are to be separated by spaces, not commas/dots.

One space every three numbers (thousands), except if you don't have three numbers (hundreds): 4 500 000 000 ; 250 200 054 ; 332 000 000 000 ; 3 457 456 124 579 ; 250 000

SI (International System of Units):
Quote:

Spaces should be used as a thousands separator (1 000 000) in contrast to commas or periods (1,000,000 or 1.000.000) to reduce confusion resulting from the variation between these forms in different countries.




Re: Human readable numbers - MP2 - 23.03.2014

Quote:
Originally Posted by CuervO
View Post
Officially "Human readable numbers" (which by the way is an awful name to give to unseparated numbers, because they are readable by most of the people) are to be separated by spaces, not commas/dots.

One space every three numbers (thousands), except if you don't have three numbers (hundreds): 4 500 000 000 ; 250 200 054 ; 332 000 000 000 ; 3 457 456 124 579 ; 250 000

SI (International System of Units):
99% of people would use and expect commas.