Permission to write 3 numbers, rest of it censured.
#3

I guess you could do a loop to go through each character in the string and check if it's numeric, and if it is, censor it. For example:

pawn Код:
new string[] = "Hello world 127.0.0.1";
new count = 0;
for(new i = 0; i < sizeof(string); i++)
{
    if (((string[i] <= '9' && string[i] >= '0') || !(i==0 && (string[i]=='-' || string[i]=='+')))) // Taken from IsNumeric by DracoBlue
    {
        count++;
        if(count > 3) string[i] = '*';
    }
}
Edit: Someone beat me to it
Reply


Messages In This Thread
Permission to write 3 numbers, rest of it censured. - by Whizion - 11.11.2010, 13:08
Re: Permission to write 3 numbers, rest of it censured. - by rs.pect - 11.11.2010, 13:11
Re: Permission to write 3 numbers, rest of it censured. - by JaTochNietDan - 11.11.2010, 13:17
Re: Permission to write 3 numbers, rest of it censured. - by Whizion - 11.11.2010, 13:19

Forum Jump:


Users browsing this thread: 1 Guest(s)