Invalid character constant
#1

Hey guys (ignore my previous thread, I am trying to create my own script)
Why am I having this error ?
PHP код:
    for(new 04i++)
    {
        if(!
IsNumeric(s[i]))
        {
            for(new 
05j++)
            {
                switch(
s[i][j])
                {
                    case 
0..9: continue;
                     default: 
s[i][j] = '';
                }
            }
        }
    } 
Код:
error 027: invalid character constant
PHP код:
default: s[i][j] = ''
Reply
#2

You can't do that, what you want is to replace the character with another character, you can't make it empty except you fill it with space, therefore if you have this string: "12ab3" and you replace each non numeric character with a space it would be:
Код:
{'1', '2', ' ', ' ', '3' '\0'}
{49, 50, 32, 32, 51, 0} // just for instance
"12  3"
Or even if you replace it with a null terminator '\0' or 0, therefore it would give you:
Код:
{'1', '2', '\0', '\0', '3', '\0'}
{49, 50, 0, 0, 51, 0} // just for instance
"12"
If you are expecting to have "123", you have to make an extra string and copy only the numbers instead of replacing the whole characters (skipping the non numeric and copy the number instead). If you are really wanting to make an anti-advert, then i suggest you to follow the code answered in your previous threads since your code is wrong especially at how you check the numbers
Код:
if(!IsNumeric(s[i])) // Redudant

case 0..9: continue; // Wrong, 0 to 9 are: 	 (you can't see these special characters/symbols, but you can copy paste it)
Sorry for my poor english.
Reply
#3

You do realize that's still not going to get the job done (along with your two other threads)?
Reply
#4

Alright I go with you, what do I do if someone adverts a domain ? E.G: server.blabla.com:4444
Reply
#5

Its not that easy to filter sth like this: https://sampforum.blast.hk/showthread.php?tid=568668
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)