Java 17 Recipes


Download 3.2 Mb.
Pdf ko'rish
bet203/245
Sana02.06.2024
Hajmi3.2 Mb.
#1839910
1   ...   199   200   201   202   203   204   205   206   ...   245
Bog'liq
Java 17 Recipes

 How It Works
The Unicode character set contains more than a million unique code points with 
integer values ranging from 0x0000 through 0x10FFFF. Each character value has a set 
of properties. One of the properties is isDigit. If this property is true, the character 
represents a numeric digit from 0 through 9. For example, the characters with code 
point values 0x30 through 0x39 have the character glyphs 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. 
If you simply convert these code values to their corresponding integer values, you get 
the hexadecimal values 0x30 through 0x39. The corresponding decimal values are 48 
through 57. However, these characters also represent numeric digits. When using them 
in calculations, these characters represent the values 0 through 9.
When a character has the digit property, use the Character.digit() static method 
to convert it to its corresponding integer digit value. Note that the digit() method is 
overloaded to accept either char or int arguments. Additionally, the method requires 
a radix. Common values for the radix are 2, 10, and 16. Interestingly, although the 
characters a–f and A–F do not have the digit property, they can be used as digits using 
radix 16. For these characters, the digit() method returns the expected integer values 
10 through 15.
A complete understanding of the Unicode character set and Java’s implementation 
requires familiarity with several new terms: character, code point, char, encoding, 
serialization encoding, UTF-8, and UTF-16. These terms are beyond the scope 
of this recipe, but you can learn more about these and other Unicode concepts 
from the Unicode website at 
http://unicode.org
 or the Character class Java API 
documentation.
Chapter 11 UniCode, internationalization, and CUrrenCy Codes 


401

Download 3.2 Mb.

Do'stlaringiz bilan baham:
1   ...   199   200   201   202   203   204   205   206   ...   245




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling