Java Utililty Methods Char Convert To

List of utility methods to do Char Convert To

Description

The list of methods to do Char Convert To are organized into topic(s).

Method

intcharToDigit(char c)
char To Digit
return CODEX.indexOf(c);
StringcharToEscape(char ch)
Return the Java Unicode escape sequence for the given character.
String hexValue = Integer.toHexString(ch);
if (hexValue.length() == 1) {
    return "\\u000" + hexValue;
if (hexValue.length() == 2) {
    return "\\u00" + hexValue;
if (hexValue.length() == 3) {
...
StringcharToHTML(char ch, boolean xml)
Converts a character to HTML or XML entity.
int c;
if (ch == '<') {
    return ("&lt;");
else if (ch == '>') {
    return ("&gt;");
else if (ch == '&') {
...
LongcharToLong(final char value)
char To Long
return (long) value;
charcharToLowerCase(char c)
char To Lower Case
if (c >= 'A' && c <= 'Z')
    return (char) (c - ('A' - 'a'));
return c;
StringcharToNCRef(int c)
Convert a single unicode scalar value to an XML numeric character reference.
StringBuffer sb = new StringBuffer();
for (int i = 0, nDigits = (c > 0xFFFF) ? 6 : 4; i < nDigits; i++, c >>= 4) {
    int d = c & 0xF;
    char hd;
    if (d < 10) {
        hd = (char) ((int) '0' + d);
    } else {
        hd = (char) ((int) 'A' + (d - 10));
...
bytecharToNum(char c)
char To Num
switch (c) {
case '0':
    return 0x0;
case '1':
    return 0x1;
case '2':
    return 0x2;
case '3':
...
intcharToNybble(char c)
char To Nybble
if (Character.isDigit(c)) {
    return c - '0';
return (Character.toUpperCase(c) - 'A') + 10;
intcharToOctet(char c)
char To Octet
if (c > '9') {
    if (c > 'F') {
        return c - 'a' + 10;
    return c - 'A' + 10;
return c - '0';
StringcharToUpperOrLower(String string, int pos, boolean upper)
Puts the given char to upper (true) or lower (false) case
if (pos < 0 || pos >= string.length()) {
    throw new StringIndexOutOfBoundsException(pos);
String ret = string.substring(0, pos);
if (upper) {
    ret += string.substring(pos, pos + 1).toUpperCase();
} else {
    ret += string.substring(pos, pos + 1).toLowerCase();
...