Java Reference
In-Depth Information
Problem
You want to convert a Unicode digit character to its respective integer value. For ex-
ample, you have a string containing the Thai digit for the value 8 and you want to gen-
erate an integer with that value.
Solution
The java.lang.Character class has several static methods to convert characters
to integer digit values:
public static intdigit(char ch, int radix)
public static intdigit(intch, int radix)
The following code snippet iterates through the entire range of Unicode code points
from 0x0000 through 0x10FFFF . For each code point that is also a digit, it displays
the character and its digit value 0 through 9. You can find this example in the
org.java8recipes.chapter12.recipe12_1.Recipe12_1 class.
Search WWH ::




Custom Search