“Java Unicode -Zeichen” Code-Antworten

Java Unicode -Zeichen

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

Unicode in 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 in Java


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

Glorious Gharial

Ähnliche Antworten wie “Java Unicode -Zeichen”

Fragen ähnlich wie “Java Unicode -Zeichen”

Weitere verwandte Antworten zu “Java Unicode -Zeichen” auf Java

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen