1K instead of 1000
#3

Just wrote a simple function see if it fit your need : p
PHP код:
public OnFilterScriptInit()
{
    new 
str[] = { 'M'1000000'K'1000 };
    new 
value GetValue("126MK"str);
    
printf("%d"value);
}
GetValue(str[], const vals[])
{
    new 
val 0len strlen(vals);
    if(
len != && (len 2))
        
len--;
    for(new 
0strlen(str); ji++)
    {
        if(
str[i] >= '0' && val <= '9')
        {
               
val *= 10;
            
val += str[i] - '0';
        }
        else
        {
            for(new 
0len+= 2)
            {
                if(
tolower(str[i]) == tolower(vals[q]))
                {
                    
val *= vals[1];
                }
            }
        }
    }
    return 
val;

Reply


Messages In This Thread
1K instead of 1000 - by AzaMx - 13.08.2018, 13:26
Re: 1K instead of 1000 - by CodeStyle175 - 13.08.2018, 13:41
Re: 1K instead of 1000 - by jlalt - 13.08.2018, 14:08
Re: 1K instead of 1000 - by AzaMx - 14.08.2018, 09:14
Re: 1K instead of 1000 - by OneDay - 14.08.2018, 10:47
Re: 1K instead of 1000 - by AzaMx - 14.08.2018, 21:54
Re: 1K instead of 1000 - by Crystallize - 15.08.2018, 00:34
Re: 1K instead of 1000 - by AzaMx - 15.08.2018, 03:24
Re: 1K instead of 1000 - by Gammix - 15.08.2018, 09:19
Re: 1K instead of 1000 - by AzaMx - 16.08.2018, 00:09

Forum Jump:


Users browsing this thread: 2 Guest(s)