Character codes: Difference between revisions

Content added Content deleted
No edit summary
Line 1,169: Line 1,169:
97 98 99 9786</syntaxhighlight>
97 98 99 9786</syntaxhighlight>


<code>7 u:</code> converts from utf-8, <code>3 u:</code> by itself would give us:
<code>7 u:</code> converts from utf-8 to utf-16 (<code>9 u:</code> would instead have converted to utf-32), <code>3 u:</code> by itself would give us:


<syntaxhighlight lang="j"> 3 u: 'abc☺'
<syntaxhighlight lang="j"> 3 u: 'abc☺'
Line 1,180: Line 1,180:
a.i.'abc'
a.i.'abc'
97 98 99</syntaxhighlight>
97 98 99</syntaxhighlight>

=={{header|Java}}==
=={{header|Java}}==
<tt>char</tt> is already an integer type in Java, and it gets automatically promoted to <tt>int</tt>. So you can use a character where you would otherwise use an integer. Conversely, you can use an integer where you would normally use a character, except you may need to cast it, as <tt>char</tt> is smaller.
<tt>char</tt> is already an integer type in Java, and it gets automatically promoted to <tt>int</tt>. So you can use a character where you would otherwise use an integer. Conversely, you can use an integer where you would normally use a character, except you may need to cast it, as <tt>char</tt> is smaller.