in general, you need to know the number of the first occurrence of the character "\" in the string. but string.indexOf("\"); does not work. and string.indexOf('\034'); gives nothing.

  • Tell me please, if I correctly understood this construction returns either true or false, does it follow from this that you can shove it all into if else, if so, how? - George

1 answer 1

The backslash character is service and must be escaped:

 string.indexOf("\\");