0

How To Escape String Like Below. I Use Below Code But Say

"The method unescape(String) is undefined for the type printpreview"

String s = unescape(stringFromDatabase)

I saw this method from this link:

New Line character \n not displaying properly in textView Android

I want to "Line 1\nLine 2\nLine 3\nLine 4\nLine 5" String to below but not work

Line 1

Line 2

Line 3

Line 4

Line 5

Community
  • 1
  • 1
david
  • 753
  • 4
  • 14
  • 26

1 Answers1

-1

you should define it yourself ;-).

a suggestion from the thread you were refering to was

private String unescape(String description) {
   return description.replaceAll("\\\\n", "\\\n");

}

But off course it depends what you are trying to do whether this will work.

Jeroen Coupé
  • 1,394
  • 11
  • 13