Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Character-codes/NetRexx/character-codes.netrexx
Normal file
23
Task/Character-codes/NetRexx/character-codes.netrexx
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/* NetRexx */
|
||||
options replace format comments java crossref symbols nobinary
|
||||
|
||||
runSample(arg)
|
||||
return
|
||||
|
||||
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
method runSample(arg) private static
|
||||
-- create some sample data: character, hex and unicode
|
||||
samp = ' ' || 'a'.sequence('e') || '$' || '\xa2'.sequence('\xa5') || '\u20a0'.sequence('\u20b5')
|
||||
-- use the C2D C2X D2C and X2C built-in functions
|
||||
say "'"samp"'"
|
||||
say ' | Chr C2D C2X D2C X2C'
|
||||
say '---+ --- ------ ---- --- ---'
|
||||
loop ci = 1 to samp.length
|
||||
cc = samp.substr(ci, 1)
|
||||
cd = cc.c2d -- char to decimal
|
||||
cx = cc.c2x -- char to hexadecimal
|
||||
dc = cd.d2c -- decimal to char
|
||||
xc = cx.x2c -- hexadecimal to char
|
||||
say ci.right(3)"| '"cc"'" cd.right(6) cx.right(4, 0) "'"dc"' '"xc"'"
|
||||
end ci
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue