Here you can find the source of unescape(String input)
Parameter | Description |
---|---|
input | a parameter |
public static String unescape(String input)
//package com.java2s; /*/*from w w w. j ava2 s . co m*/ * Tigase Jabber/XMPP XML Tools * Copyright (C) 2004-2007 "Artur Hefczyc" <artur.hefczyc@tigase.org> * * This program 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 3 of the License. * * This program 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 this program. Look for COPYING file in the top folder. * If not, see http://www.gnu.org/licenses/. * * $Rev: 480 $ * Last modified by $Author: cvsdeploy $ * $Date: 2012/08/20 21:20:17 $ */ public class Main { private static final String[] decoded = { "&", "<", ">", "\"", "\'" }; private static final String[] encoded = { "&", "<", ">", """, "'" }; /** * Method description * * * @param input * * @return */ public static String unescape(String input) { return translateAll(input, encoded, decoded); } /** * Method description * * * @param input * @param patterns * @param replacements * * @return */ public static String translateAll(String input, String[] patterns, String[] replacements) { String result = input; for (int i = 0; i < patterns.length; i++) { result = result.replaceAll(patterns[i], replacements[i]); } return result; } }