Character codes: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (→{{header|Raku}}: twiddles) |
|||
Line 2,141: | Line 2,141: | ||
see char(97) + nl |
see char(97) + nl |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
=={{header|RPL}}== |
|||
{{in}} |
|||
<pre> |
|||
"a" NUM |
|||
97 CHR |
|||
</pre> |
|||
{{out}} |
|||
<pre> |
|||
2: 97 |
|||
1: "a" |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
In Ruby 1.9 characters are represented as length-1 strings; same as in Python. The previous "character literal" syntax <tt>?a</tt> is now the same as <tt>"a"</tt>. Subscripting a string also gives a length-1 string. There is now an "ord" method of strings to convert a character into its integer code. |
In Ruby 1.9 characters are represented as length-1 strings; same as in Python. The previous "character literal" syntax <tt>?a</tt> is now the same as <tt>"a"</tt>. Subscripting a string also gives a length-1 string. There is now an "ord" method of strings to convert a character into its integer code. |
||
Line 2,148: | Line 2,160: | ||
> 97.chr |
> 97.chr |
||
=> "a"</syntaxhighlight> |
=> "a"</syntaxhighlight> |
||
=={{header|Run BASIC}}== |
=={{header|Run BASIC}}== |
||
<syntaxhighlight lang="runbasic">print chr$(97) 'prints a |
<syntaxhighlight lang="runbasic">print chr$(97) 'prints a |