Java tutorial
//package com.java2s; public class Main { public static String noMarkup(String text) { if (text == null) return null; StringBuilder sb = new StringBuilder(text.length()); boolean inMarkup = false; for (int i = 0, len = text.length(); i < len; ++i) { char c = text.charAt(i); if (inMarkup) { if (c == '>') inMarkup = false; } else { if (c == '<') inMarkup = true; else sb.append(c); } } return sb.toString(); } }