Character codes: Difference between revisions

Content added Content deleted
(PowerShell implementation)
(make J implementation support unicode)
Line 188: Line 188:


=={{header|J}}==
=={{header|J}}==
4 u: 97 98 99 9786
<lang j>cc=: {&a. :: (a.&i.)</lang>
abc☺
Examples of use:
cc 'a'
3 u: 7 u: 'abc☺'
97
97 98 99 9786

cc 97
a
cc 'alphabet'
97 108 112 104 97 98 101 116
cc 99+i.11
cdefghijklm
=={{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.