SA-MP Forums Archive
how to check a certain character - 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: how to check a certain character (/showthread.php?tid=444350)



how to check a certain character - horsemeat - 16.06.2013

Hi today I have a question about how to check a certain character in a string

I thought it was something like this because it is only one character but it give me an error
pawn Код:
if((string[s])==",");
{
                       
}
So what do I use


Re: how to check a certain character - OrMisicL - 16.06.2013

we use " " for strings and ' ' for single characters, so your code must look like

pawn Код:
if(string[s]==',')
{
                       
}
And by the way, there are other mistakes such as an extra parenthese and the ";" after "if", i fixed them in the example above


Re: how to check a certain character - horsemeat - 16.06.2013

Quote:
Originally Posted by OrMisicL
Посмотреть сообщение
we use " " for strings and ' ' for single characters, so your code must look like

pawn Код:
if(string[s]==',')
{
                       
}
And by the way, there are other mistakes such as an extra parenthese and the ";" after "if", i fixed them in the example above
Thanks