Character codes: Difference between revisions
m
Added Plain English
m (Removed spaces around Uxntal code.) |
m (Added Plain English) |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 948:
Limitations: There is no "put_character_32" feature for standard io (FILE class), so there appears to be no way to print Unicode characters.
=={{header|Elena}}==
ELENA
<syntaxhighlight lang="elena">import extensions;
Line 955:
var ch := $97;
console.printLine
console.printLine(ch.toInt())
}</syntaxhighlight>
Line 963:
97
</pre>
=={{header|Elixir}}==
A String in Elixir is a UTF-8 encoded binary.
Line 1,045 ⟶ 1,046:
fansh> 'a'.toInt
97</syntaxhighlight>
=={{header|Fennel}}==
<syntaxhighlight lang="fennel">
(string.byte :A) ; 65
(string.char 65) ; "A"
</syntaxhighlight>
=={{header|Forth}}==
As with C, characters are just integers on the stack which are treated as ASCII.
Line 1,384 ⟶ 1,392:
Langur has code point literals (enclosed in straight single quotes), which may use escape codes. They are integers.
The s2cp(), cp2s(), and
<syntaxhighlight lang="langur">val .a1 = 'a'
Line 1,396 ⟶ 1,404:
writeln .a3 == .a4
writeln "numbers: ", join ", ", [.a1, .a2, .a3, .a4, .a5]
writeln "letters: ", join ", ", map cp2s, [
{{out}}
Line 1,405 ⟶ 1,413:
letters: a, a, a, a, aaaa
</pre>
=={{header|Lasso}}==
<syntaxhighlight lang="lasso">'a'->integer
Line 1,577 ⟶ 1,586:
The character for '65' is: A.
Press any key to continue...</syntaxhighlight>
=={{header|MiniScript}}==
{{trans|Wren}}
MiniScript does not have a ''character'' type as such but one can use single character strings instead. Strings can contain any Unicode code point.
<syntaxhighlight lang="miniscript">cps = []
for c in ["a", "π", "字", "🐘"]
cp = c.code
cps.push cp
print c + " = " + cp
end for
print
for i in cps
print i + " = " + char(i)
end for</syntaxhighlight>
{{out}}
<pre>a = 97
π = 960
字 = 23383
🐘 = 128024
97 = a
960 = π
23383 = 字
128024 = 🐘
</pre>
=={{header|Modula-2}}==
<syntaxhighlight lang="modula2">MODULE asc;
Line 1,599 ⟶ 1,634:
<syntaxhighlight lang="modula-2">jan@Beryllium:~/modula/rosetta$ ./asc
a 97 1</syntaxhighlight>
=={{header|Modula-3}}==
The built in functions <code>ORD</code> and <code>VAL</code> work on characters, among other things.
Line 1,801 ⟶ 1,837:
<syntaxhighlight lang="pascal">writeln(ord('a'));
writeln(chr(97));</syntaxhighlight>
=={{header|Plain English}}==
<syntaxhighlight>
\ Obs: The little-a byte is a byte equal to 97.
Write the little-a byte's whereabouts on the console.
Put 97 into a number.
Write the number's target on the console.
</syntaxhighlight>
=={{header|Perl}}==
===Narrow===
Line 2,687 ⟶ 2,730:
=={{header|Uxntal}}==
<syntaxhighlight lang="Uxntal">
( uxnasm char-codes.tal char-codes.rom && uxncli char-codes.rom )
|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
Line 2,696 ⟶ 2,742:
newline
( exit )
#80 .System/state DEO
BRK
|