Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String enquoteIdentifier(String s) {
        char[] raw = s.toCharArray();
        StringBuilder stringBuilder = new StringBuilder();
        for (char c : raw) {
            if (c < ' ' || c > '') {
                stringBuilder.append("\\u").append(String.format("%04x", c));
                continue;
            }
            stringBuilder.append(c);
        }
        return stringBuilder.toString();
    }
}