“Unicode en Java” Réponses codées

Caractères Java Unicode

U+0020
U+00A0
U+2002
warner smith

Unicode en Java

/* Java language uses Unicode character set to manage text.
   A character set is an ordered list of characters, each assigned a numeric value.
   In Unicode, each character is represented as a 16-bit numeric value.
   Unicode character table can be found at: https://unicode-table.com/en/
*/

// Digits are assigned numeric values: '0': 48, '1': 49, ..., '9': 57
System.out.println(1 + '0'); // prints 49, the unicode of '1'
System.out.println(1 + '8'); // prints 57, the unicode of '8'

// Uppercase letters: 'A': 65, 'B': 66, 'C': 67, ..., 'Z': 90
System.out.println((char) (1+'B')); // prints letter 'C' out

// Lowercase letters: 'a': 97, 'b': 98, ..., 'z': 122
System.out.println((char) (1 + 'a')); // prints letter 'b' out

// Note that adding 32 to unicode of uppercase letter  
// gives its lowercase equivalent
System.out.println((char) (32 + 'A')); // prints 'a'
System.out.println((char) (32 + 'Z')); // prints 'z'
Wissam

Unicode en Java


String s = Character.toString((char)c);

Glorious Gharial

Réponses similaires à “Unicode en Java”

Questions similaires à “Unicode en Java”

Plus de réponses similaires à “Unicode en Java” dans Java

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code