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

byte[]charTo2Byte(char x)
char To Byte
return new byte[] { (byte) (x >> 8), (byte) x };
intCharToASCII(final char character)
Convert the characters to ASCII value
return (int) character;
TcharToBasicType(char c, Class clazz)
char To Basic Type
if (clazz.equals(Boolean.class))
    return (T) Boolean.valueOf(charToBoolean(c));
if (clazz.equals(Byte.class))
    return (T) charToByte(c);
if (clazz.equals(Character.class))
    return (T) Character.valueOf(c);
if (clazz.equals(Short.class))
    return (T) Short.valueOf((short) c);
...
booleancharToBoolean(char c)
char To Boolean
return c != 0 ? true : false;
voidcharToBuffer(char ch, byte[] ioBuffer)
char To Buffer
ioBuffer[0] = (byte) (ch >>> 8);
ioBuffer[1] = (byte) ch;
StringcharToCDATA(char ch)
Converts a character to CDATA character.
int c;
if (ch >= 128) {
    c = ch;
    return ("&#" + c + ';');
else {
    return (String.valueOf(ch));
bytecharToCompressedBaseLow(final int base)
Convert from ASCII byte to BAM nybble representation of a base in low-order nybble.
switch (base) {
case '=':
    return COMPRESSED_EQUAL_LOW;
case 'a':
case 'A':
    return COMPRESSED_A_LOW;
case 'c':
case 'C':
...
bytecharToCompressedBaseLow(final int base)
Convert from ASCII byte to BAM nybble representation of a base in low-order nybble.
switch (base) {
case '=':
    return COMPRESSED_EQUAL_LOW;
case 'a':
case 'A':
    return COMPRESSED_A_LOW;
case 'c':
case 'C':
...
bytecharToCp1252(char c)
char To Cp
byte byteVal;
if (c > 0 && c < '\u0080' || c >= '\u00a0' && c <= '\u00ff') {
    byteVal = (byte) c;
} else if (c == '\u20ac') {
    byteVal = (byte) -128;
} else if (c == '\u201a') {
    byteVal = (byte) -126;
} else if (c == '\u0192') {
...
intcharToDecimal(char c)
char To Decimal
if (c >= '0' && c <= '9')
    return c - '0';
else if (c >= 'a' && c <= 'z')
    return 10 + (c - 'a');
throw new IllegalArgumentException("cannot convert " + c + " to decimal");