We are developing a app. In which we getting a data from a json array . In that i want to replace a tag.But the emulator throws an error .Like Invalid Syntax . my code:
top=top.replaceall("<br\/>"," ");
Please help. Thanks In Advance
use
top=top.replaceall("<br\\/>"," ");
instead of
top=top.replaceall("<br\/>"," ");
EDIT : maybe String.relpaceall not work. so best way is use Regular Expressions's Matcher as :
Pattern p = Pattern.compile("<br\\/>");
String tempstr = "I love <br/> <br/> <br/> <br/>.";
Matcher matcher = p.matcher(tempstr );
String tmp = matcher.replaceAll("Android");
System.out.println(tmp);
OUTPUT IS:
Try this.
String res = Html.fromHtml(yourString).toString();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With