Reputation: 1264
I must write "\\\" in my nsstring. I tried @"\\\" But it didn't work well. Can you help me? Thanks.
Upvotes: 1
Views: 297
Reputation: 8255
Did you try @"\\\\\\"
? You need to escape each of the slashes with another slash, because \
is used as an escape character, in sequences such as \n
for new line.
Upvotes: 6
Reputation: 10864
Double the backslashes. Each one is an escape character, so to write a single \
you must write \\
.
Upvotes: 1
Reputation: 7375
You need to escape each individual backslash. Use @"\\\\\\"
in the above code. This will escape each individual backslash.
Upvotes: 0