Java String Unescape unescape(String s)

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

Description

unescape

License

Open Source License

Declaration

public static String unescape(String s) 

Method Source Code

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

public class Main {
    public static String unescape(String s) {
        String out = "";
        boolean esc = false;
        for (char c : s.toCharArray()) {
            if (esc) {
                if (c == 'n') {
                    out += '\n';
                } else if (c == 't') {
                    out += '\t';
                } else {
                    out += c;// w w w  .  j  a va2 s .  c o m
                }
                esc = false;
            } else {
                if (c == '\\') {
                    esc = true;
                } else {
                    out += c;
                }
            }
        }
        return out;
    }
}

Related

  1. unescape(String s)
  2. unescape(String s)
  3. unescape(String s)
  4. unescape(String s)
  5. unescape(String s)
  6. unescape(String s)
  7. unescape(String s, char[] charsToEscape)
  8. unescape(String s, int i)
  9. unescape(String s, String toUnescape)