Here you can find the source of toCharCode(String s)
s
.
Parameter | Description |
---|---|
s | the string whose character codes are to be represented |
s
public static String toCharCode(String s)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a va2 s . c o m*/ * Returns a string representing the Unicode character codes of the characters comprising the string <code>s</code>. * * <p> * Example: * </p> * * <pre> * <code> * toCharCode("a") returns "97" * toCharCode("b") returns "98" * toCharCode("c") returns "99" * toCharCode("What's for lunch?") returns "87104971163911532102111114321081171109910463" * </code> * </p> * * @param s the string whose character codes are to be represented * @return a string representing the Unicode character codes of the * characters comprising the string * <code>s</code> */ public static String toCharCode(String s) { StringBuilder sb = new StringBuilder(s.length()); for (int i = 0; i < s.length(); i++) { sb.append(s.codePointAt(i)); } return sb.toString(); } }