String.indexOf and forward slashes

Hi All,

Does the mystring.indexOf() function supports search strings that contain forward slashes?
In my program I just try to find the index of a closing XML tag, from an XML request I extract from a UDP packet. Below is the statement :

intPosB = strUDPMsg.indexOf("");

Enabling this statement - although not executed when no UDP packet is received - causes garbage output via the Serial connection.
Enabling the following statement has no influence :

intPosA = strUDPMsg.indexOf("");

So, I suspect the indexOf function of the String object cannot cope with forward slashes in the search string. Could somebody tell me how to escape this properly?

Kind regards,


Could somebody tell me how to escape this properly?

Doesn't the standard escape character () wortk?

It’s always nice to make a test case which proves your point. I made one which disproves it:

void setup ()
 String strUDPMsg = "<request> hi there </request>";

int intPosB = strUDPMsg.indexOf("</request>");

Serial.begin (115200);

Serial.print ("intPosB = ");
Serial.println (intPosB, DEC);

void loop () {}


intPosB = 19