Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {
    public static String u2s(String u) {
        Pattern pat = Pattern.compile("[\\\\U|\\\\u]([0-9a-fA-F]{4})");
        Matcher mat = pat.matcher(u);
        while (mat.find()) {
            String HEX = mat.group(1);
            char v = (char) (Integer.parseInt(HEX.toUpperCase(), 16));
            mat = pat.matcher(u = u.replace("\\" + mat.group(), "" + v));
        }
        return u;
    }
}