Java String Unescape unescape(String line)

Here you can find the source of unescape(String line)

Description

Parse html/xml escape sequences

License

Open Source License

Parameter

Parameter Description
line The string which is escaped

Return

The normal string

Declaration

public static String unescape(String line) 

Method Source Code

//package com.java2s;
/*/*  w w  w  . j  a v a 2s  . c om*/
 * Copyright (C) 2011 Sony Ericsson Mobile Communications AB
 * Copyright (C) 2012 Sony Mobile Communications AB
 *
 * This file is part of ChkBugReport.
 *
 * ChkBugReport is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * ChkBugReport 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ChkBugReport.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /**
     * Parse html/xml escape sequences
     * @param line The string which is escaped
     * @return The normal string
     */
    public static String unescape(String line) {
        line = line.replace("&amp;", "&");
        line = line.replace("&quot;", "\"");
        line = line.replace("&gt;", ">");
        line = line.replace("&lt;", "<");
        return line;
    }
}

Related

  1. unescape(String escapedMessage)
  2. unescape(String input)
  3. unescape(String input)
  4. unescape(String input, char escapeChar)
  5. unescape(String line)
  6. unescape(String line, int start, int end)
  7. unescape(String literal, String escapedChars)
  8. unescape(String name)
  9. unescape(String oldStr)