escape in strcmp - 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: escape in strcmp (
/showthread.php?tid=618834)
escape in strcmp -
MerryDeer - 10.10.2016
Hi,
I need use escape in when strmp?
Re: escape in strcmp -
SyS - 10.10.2016
What you mean ?
You meant to use escape sequences in strcmp?
\\ mean single \ in string.
Re: escape in strcmp -
MerryDeer - 10.10.2016
Yes ,but if there just \ i can strcmp?
strcmp("\","something")
?
Re: escape in strcmp -
Stinged - 10.10.2016
I really don't like being an asshole here, but your questions are really starting to get on my nerves.
I suggest you start listening to others, or else you won't learn (You still haven't) anything.
A lot of people here told you to test simple stuff and find out yourself.
Here's a simple line of code that'll answer your question:
Код:
printf("%i\n%i\n%i", strcmp("\\test", "\test"), strcmp("\test", "\test"), strcmp("\\test", "\\test"));
strcmp returns 0 when the two strings you're comparing are equal.
Re: escape in strcmp -
MerryDeer - 10.10.2016
But if there just \ without test ?
Re: escape in strcmp -
SyS - 10.10.2016
Quote:
Originally Posted by MerryDeer
But if there just \ without test ?
|
you have hands ,a keyboard and pawno application try it yourself
Re: escape in strcmp -
MerryDeer - 10.10.2016
I can't write string only \
Re: escape in strcmp -
Bolex_ - 10.10.2016
https://sampforum.blast.hk/showthread.php?tid=199796
Re: escape in strcmp -
azzerking - 10.10.2016
In pawn the '
\' is known as the escape character, so any character that follows after the '
\' will be escaped for example:
Код:
print( "MJ said \"Music\" is great." );
As you can see I put two '
\' ( backslashes ) before each quotation mark. This is because I don't want the compiler to think my string has ended when it gets to "Music". So by using the escape character I have told the compiler to ignore the following character and treat it like its still a string.
Offtopic: I seem to have more patient then the previous posters.
Re: escape in strcmp -
SyS - 11.10.2016
Quote:
Originally Posted by MerryDeer
I can't write string only \
|
Thats what we both told you before.Now you understood?
Quote:
Originally Posted by azzerking
Offtopic: I seem to have more patient then the previous posters.
|
Try to help more in his threads and check his background and former threads.Your patience eventually will become destroyed.