Size: 479
Comment: origin independent
|
← Revision 10 as of 2009-09-03 07:12:19 ⇥
Size: 760
Comment: problem beyond unicode 127
|
Deletions are marked like this. | Additions are marked like this. |
Line 23: | Line 23: |
These functions have a problem in ''Dyalog Unicode'' edition for characters beyond `⎕UCS 127`; the last line of `HexToText` appears to be to squeeze out `⎕AV[0]` that appears in alternating positions of `82 ⎕DR ⍵` if such characters are included in the ''Classic'' edition. |
Hex And Text
From time to time you might have to convert strings to hex or vice versa:
TextToHex←{ a←83 ⎕DR ⍵ a←⎕IO+,⍉16 16⊤a '0123456789ABCDEF'[a] }
And the other way round:
HexToText←{ a←16|-⎕IO-'0123456789ABCDEF0123456789abcdef'⍳⍵ a←{⍵⍴⍨2,⍨0.5×⍴⍵}a a←16⊥⍉a {⍵{(⍺{⍵⍴(⍵÷⍴⍺)↑1}⍴⍵)/⍵}82 ⎕DR ⍵}a }
These functions have a problem in Dyalog Unicode edition for characters beyond ⎕UCS 127; the last line of HexToText appears to be to squeeze out ⎕AV[0] that appears in alternating positions of 82 ⎕DR ⍵ if such characters are included in the Classic edition.