Character codes: Difference between revisions

m
Added Plain English
(→‎{{header|Modula-2}}: Added MiniScript)
m (Added Plain English)
(4 intermediate revisions by 4 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 46.x :
<syntaxhighlight lang="elena">import extensions;
 
Line 955:
var ch := $97;
 
console.printLine:(ch);
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 cp2ss2gc() functions convert between code point integers, grapheme clusters and strings. Also, string indexing is by code point.
 
<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, [cp2s(.a1), cp2s(.a2), cp2s(.a3), cp2s(.a4), cp2s(.a5)]</syntaxhighlight>
 
{{out}}
Line 1,405 ⟶ 1,413:
letters: a, a, a, a, aaaa
</pre>
 
=={{header|Lasso}}==
<syntaxhighlight lang="lasso">'a'->integer
Line 1,828 ⟶ 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,714 ⟶ 2,730:
 
=={{header|Uxntal}}==
<syntaxhighlight lang="Uxntal">|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
( 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,723 ⟶ 2,742:
newline
 
( exit )
#80 .System/state DEO
BRK
18

edits