Here you can find the source of unescape(final String text)
public static String unescape(final String text)
//package com.java2s; /**/*from w w w.j a va2s .co m*/ * This file is part of Everit - HTML Templating. * * Everit - HTML Templating is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Everit - HTML Templating is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Everit - HTML Templating. If not, see <http://www.gnu.org/licenses/>. */ public class Main { public static String unescape(final String text) { StringBuilder result = new StringBuilder(text.length()); int i = 0; int n = text.length(); while (i < n) { char charAt = text.charAt(i); if (charAt != '&') { result.append(charAt); i++; } else { if (text.startsWith("&", i)) { result.append('&'); i += 5; } else if (text.startsWith("'", i)) { result.append('\''); i += 6; } else if (text.startsWith(""", i)) { result.append('"'); i += 6; } else if (text.startsWith("<", i)) { result.append('<'); i += 4; } else if (text.startsWith(">", i)) { result.append('>'); i += 4; } } } return result.toString(); } }