Java String Unescape unescape(String escapedMessage)

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

Description

Returns a string with all escaped occurrence of StringUtils.SEPARATOR unescaped

License

Open Source License

Parameter

Parameter Description
escapedMessage a parameter

Declaration

public static String unescape(String escapedMessage) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static final String SEPARATOR = "|";

    /**/*from w  w w .  j a v  a 2  s  . com*/
     * Returns a string with all escaped occurrence of StringUtils.SEPARATOR unescaped
     * @param escapedMessage
     * @return 
     */
    public static String unescape(String escapedMessage) {
        return unescape(escapedMessage, SEPARATOR);
    }

    /**
     * Returns a string with all escaped occurrence of reserved unescaped
     * @param escapedMessage
     * @param reserved
     * @return 
     */
    public static String unescape(String escapedMessage, String reserved) {
        String escaped = String.format("\\%s", reserved);
        return escapedMessage.replace(escaped, reserved).replaceFirst("\\\\ $", "\\\\");
    }
}

Related

  1. unescape(String elt)
  2. unescape(String entry)
  3. unescape(String escaped)
  4. unescape(String escaped)
  5. unescape(String escaped, char escape)
  6. unescape(String input)
  7. unescape(String input)
  8. unescape(String input, char escapeChar)
  9. unescape(String line)