Character codes: Difference between revisions

m
Added Plain English
imported>Arakov
m (Added Plain English)
(3 intermediate revisions by 3 users not shown)
Line 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,385 ⟶ 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,397 ⟶ 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,406 ⟶ 1,413:
letters: a, a, a, a, aaaa
</pre>
 
=={{header|Lasso}}==
<syntaxhighlight lang="lasso">'a'->integer
Line 1,829 ⟶ 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,715 ⟶ 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,724 ⟶ 2,742:
newline
 
( exit )
#80 .System/state DEO
BRK
18

edits