0

I have an app that uses Parse as a backend. Parse calls a web scraper which returns a string to Parse and I have to use stringify on the string I received because it's not always allowed to be sent over the network otherwise. Once I stringify that string how can I parse it in Java so that I have the original returned string. For instance, how do I go from this stringified string in javascript

"\"This is a string\"\r\n\t\t"

To this string in java

"This is a string"

To reiterate, I start with a String (such as "This is a string") but then have to stringify that to send it over the network (result "\"This is a string\"\r\n\t\t"). Once I return the stringified string to my android app, how can I get back the original string ("This is a string")?

1

1 Answer 1

1

Try StringEscapeUtils from apache commons

String input = "\"This is a string\"\r\n\t\t";

String output = StringEscapeUtils.unescapeJava(input);

System.out.println(output);

"This is a string"
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the help, but I went ahead and used quite regex expression to take out escape characters. I didn't want to download a library that I would only need for one thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.