An arbitrary string comes from the remote service.

Depending on the presence of the "Body:" substring, I have to parse it in various ways, I do this:

  String longString = service.getString(); if (longString.indexOf("Body:") != -1) { // some code } else { // enother code } 

But when a line like "Body:\Dsdqwe...." logic works from the else block. Why and how can I fix it?

  • why \D and not \\D ? - Alexey Shimansky
  • This is the service that comes that comes. - Denis Vabishchevich
  • And how exactly does the string look exactly from the service? Because on "Body:\Dsdqwe" in general kmk, an error should pop up, but not fall into some of the conditions ..... because it is invalid .... or something is necessary to "escape" avajava.com/tutorials / lessons / ... - Alexey Shimansky
  • Or maybe such that \D interpreted as deleting a character or something like that, and therefore the string Body: does not find it? - Denis Vabishchevich
  • Can. that is why my comments and written) - Alexey Shimansky

0