• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to search for a backslash in a String?  RSS feed

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this out:

output:

backSlashA: -1, backSlashB: -1, backSlashC: -1
u: \ v: \ w: \

How can I find that backslash in String strX?
Can anyone shed any light on this?

Thanks in advance!
 
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that strX does not contain a backslash.

The one backslash in strX is the escape symbol before t.

So the string is actually

 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also I don't understand how you are getting the output shown. When I tried it
the output was:

backSlashA: -1, backSlashB: -1, backSlashC: -1
u: " v: " w: \

"\u005c""

is the same as
"\""

which prints
"
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!