Java Java String Unescape unescapeJava(String escaped)

Here you can find the source of unescapeJava(String escaped)

Description

unescape Java

License

Apache License

Declaration

public static String unescapeJava(String escaped) 

Method Source Code

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

public class Main {
    public static String unescapeJava(String escaped) {
        if (escaped.indexOf("\\u") == -1)
            return escaped;

        String processed = "";

        int position = escaped.indexOf("\\u");
        while (position != -1) {
            if (position != 0)
                processed += escaped.substring(0, position);
            String token = escaped.substring(position + 2, position + 6);
            escaped = escaped.substring(position + 6);
            processed += (char) Integer.parseInt(token, 16);
            position = escaped.indexOf("\\u");
        }//w  w  w. j a  v  a 2s  .  com
        processed += escaped;

        return processed;
    }
}

Related

  1. unescapeJava(final String s)
  2. unescapeJava(final String str)
  3. unescapeJava(final String str)
  4. unescapeJava(String s)
  5. unescapeJava(String str)
  6. unescapeJava(String value)