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

intconvertChar(char c)
convert Char
if ('0' <= c && c <= '9') {
    return c - '0';
} else if ('a' <= c && c <= 'f') {
    return c - 'a' + 0xa;
} else if ('A' <= c && c <= 'F') {
    return c - 'A' + 0xa;
} else {
    throw new IllegalArgumentException("Invalid hex character: " + c);
...
CharacterconvertCharacter(final String value)
convert Character
if (value.length() > 0) {
    return Character.valueOf(value.charAt(0));
} else {
    return null;
charconvertCharacterEntity(String value)
convert Character Entity
return convert(value);
intconvertCharacterOffsetToCodePointOffset(String inputStr, int charOffset)
Computes the code point offset for the specified character offset in the input string
return Character.codePointCount(inputStr, 0, charOffset);
StringconvertCharacters(String fileName)
convert Characters
return fileName.replace(':', ' ').replace('|', ' ').replace('*', ' ').replace('?', ' ');
Character[]convertCharArray(char[] arr)
convert Char Array
Character[] ret = new Character[arr.length];
for (int i = 0; i < arr.length; i++) {
    ret[i] = arr[i];
return ret;
int[]convertCharArrayToIntArray(char[] chars)
convert Char Array To Int Array
int[] nums = new int[chars.length];
try {
    for (int i = 0; i < chars.length; i++) {
        nums[i] = Integer.parseInt(String.valueOf(chars[i]));
} catch (NumberFormatException e) {
    e.printStackTrace();
return nums;
StringconvertChars(String orig_name, String chars, char toChar)
convert Chars
StringBuffer tmp = new StringBuffer(orig_name);
int i;
for (i = 0; i < tmp.length(); i++) {
    if (chars.indexOf(tmp.charAt(i)) != -1) {
        tmp.setCharAt(i, toChar);
return new String(tmp);
...
StringconvertCharSet(String str, String desCharset)
convert Char Set
return convertCharSet(str, null, desCharset);
StringconvertCharsToUnicodeChars(final String s, final boolean toLowerCase)
Converts all characters from the given String to unicodes characters encoded like \uxxxx.
if (s == null || s.length() == 0) {
    return s;
int length = s.length();
int sbLength = length * 2;
StringBuilder sb = new StringBuilder(sbLength);
for (int i = 0; i < length; i++) {
    char c = s.charAt(i);
...