Character codes: Difference between revisions

Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag
(Add Draco)
(Replace println() with print(); replace output "syntaxhighlight" tag with "pre" tag)
Line 852:
Char fromCodePoint = codepoint.toChar(); // or: "new Char(codepoint)"
 
console.printlnprint($|Character {char.quoted()}:\
| Unicode codepoint={char.codepoint},\
| ASCII={char.ascii},\
| UTF8 bytes={char.utf8()},\
| char from codepoint={fromCodePoint.quoted()}
);
}
}
Line 863:
</syntaxhighlight>
 
{{out}}
Resulting output:
<pre>
<syntaxhighlight lang="text">
Character '\0': Unicode codepoint=0, ASCII=True, UTF8 bytes=0x00, char from codepoint='\0'
Character '\d': Unicode codepoint=127, ASCII=True, UTF8 bytes=0x7F, char from codepoint='\d'
Character 'A': Unicode codepoint=65, ASCII=True, UTF8 bytes=0x41, char from codepoint='A'
Character '$': Unicode codepoint=36, ASCII=True, UTF8 bytes=0x24, char from codepoint='$'
Character '¢': Unicode codepoint=162, ASCII=False, UTF8 bytes=0xC2A2, char from codepoint='¢'
Character '~': Unicode codepoint=126, ASCII=True, UTF8 bytes=0x7E, char from codepoint='~'
Character '˜': Unicode codepoint=732, ASCII=False, UTF8 bytes=0xCB9C, char from codepoint='˜'
</pre>
</syntaxhighlight>
 
=={{header|Eiffel}}==
162

edits