Android examples for java.lang:String HTML
remove HTML Tags from string
import android.net.Uri; public class Main{ public static String removeTags(String str) { if (str == null) { throw new IllegalArgumentException("Str must not be null."); }/*from w w w. jav a2 s . c o m*/ // StringBuffer out = new StringBuffer(); char cs[] = str.toCharArray(); boolean tagFound = false; int i1 = 0; int l = 0; // for (int i = 0; i < cs.length; i++) { if (cs[i] == '<' && !tagFound) { out.append(cs, i1, l); // i1 = i; l = 0; tagFound = true; l++; } else if (cs[i] == '>' && tagFound) { i1 = i + 1; l = 0; tagFound = false; } else { l++; } } if (l > 0) { out.append(cs, i1, l); } // return out.toString().trim(); } }