Java String Unescape unEscapeString(String str)

Here you can find the source of unEscapeString(String str)

Description

un Escape String

License

Apache License

Declaration

public static String unEscapeString(String str) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static String unEscapeString(String str) {
        if (str == null)
            return null;

        str = str.replaceAll("%20", " ");
        str = str.replaceAll("%3C", "<");
        str = str.replaceAll("%3E", ">");
        str = str.replaceAll("%23", "#");
        str = str.replaceAll("%7B", "{");

        str = str.replaceAll("%7D", "}");
        str = str.replaceAll("%7C", "|");
        str = str.replaceAll("%5C", "\\\\");
        str = str.replaceAll("%0A", "\n");
        str = str.replaceAll("%5E", "^");
        str = str.replaceAll("%7E", "~");

        str = str.replaceAll("%5B", "[");
        str = str.replaceAll("%5D", "]");
        str = str.replaceAll("%60", "'");
        str = str.replaceAll("%3B", ";");
        str = str.replaceAll("%2F", ",");

        str = str.replaceAll("%3F", "?");
        str = str.replaceAll("%3A", ":");
        str = str.replaceAll("%40", "@");
        str = str.replaceAll("%3D", "=");
        str = str.replaceAll("%26", "&");
        str = str.replaceAll("%24", "$");

        str = str.replaceAll("%E4", "\u00e4");
        str = str.replaceAll("%C4", "\u00c4");
        str = str.replaceAll("%F6", "\u00f6");
        str = str.replaceAll("%D6", "\u00d6");
        str = str.replaceAll("%FC", "\u00fc");
        str = str.replaceAll("%DC", "\u00dc");
        str = str.replaceAll("%DF", "\u00df");

        str = str.replaceAll("%25", "%");
        str = str.replaceAll("%22", "\"");
        str = str.replaceAll("%2C", ",");

        return str;
    }//w  w  w  .  java  2s .  com
}

Related

  1. unescapeString(String s)
  2. unescapeString(String s, char enclosed)
  3. unEscapeString(String str)
  4. unEscapeString(String str)
  5. unescapeString(String str)
  6. unescapeString(String string)
  7. unescapeString(String string, String escapeChars, char escapeSymbol)
  8. unescapeString(String t)
  9. unescapeString(String text)