Here you can find the source of appendHexJavaScriptRepresentation(StringBuilder sb, char c)
Parameter | Description |
---|---|
sb | The buffer to which the hex representation should be appended. |
c | The character to be appended. |
public static void appendHexJavaScriptRepresentation(StringBuilder sb, char c)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w.ja va 2 s . c o m * Returns a javascript representation of the character in a hex escaped * format. Although this is a rather specific method, it is made public * because it is also used by the JSCompiler. * * @param sb The buffer to which the hex representation should be appended. * @param c The character to be appended. */ public static void appendHexJavaScriptRepresentation(StringBuilder sb, char c) { sb.append("\\u"); String val = Integer.toHexString(c); for (int j = val.length(); j < 4; j++) { sb.append('0'); } sb.append(val); } }