Java String Unescape unescape(String value)

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

Description

Unescapes characters that are escaped in a call to compose.

License

Open Source License

Declaration

public static String unescape(String value) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   www  .  ja  v  a  2  s . c  o  m
     * Unescapes characters that are escaped in a call to compose.
     */
    public static String unescape(String value) {
        int bsidx = value.indexOf('\\');
        if (bsidx == -1) {
            return value;
        }

        StringBuilder buf = new StringBuilder();
        int vlength = value.length();
        for (int ii = 0; ii < vlength; ii++) {
            char ch = value.charAt(ii);
            if (ch != '\\' || ii == vlength - 1) {
                buf.append(ch);
            } else {
                // look at the next character
                ch = value.charAt(++ii);
                buf.append((ch == '!') ? '|' : ch);
            }
        }

        return buf.toString();
    }
}

Related

  1. unescape(String val)
  2. unescape(String val, char quote)
  3. unescape(String value)
  4. unescape(String value)
  5. unescape(String value)
  6. unescape(String value)
  7. unescape(String value)
  8. unescape(String value)
  9. unEscape(String value)