how to check a certain character
#1

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
Reply
#2

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
Reply
#3

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)