When I run my code i get this error

Main.java:44: illegal escape character
y = news.indexOf("<\description>");

It points to the \d part and I cant seem to use this in the indexof function but I need to search for that exact string is there anyway around this?

Recommended Answers

All 2 Replies

There's a way you can get around that. I think its by putting a backslash before the thing it thinks is an illegal escape character. So try \\d.

i believe bestjew is correct, but more importantly, what is "<\description>"? my guess is it is comming from XML, but that is not correct, do you want "</description>" instead?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.