Differences between revisions 3 and 4
Revision 3 as of 2007-03-13 15:14:43
Size: 469
Editor: KaiJaeger
Comment:
Revision 4 as of 2007-05-10 16:12:22
Size: 473
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
{{{  {{{
Line 12: Line 12:
}}}  }}}
Line 16: Line 16:
{{{  {{{
Line 22: Line 22:
}}}  }}}

Hex And Text

From time to time you might have to convert strings to hex or vice versa:

  • HexToText←{
         a←16|'123456789ABCDEF0123456789abcdef'⍳⍵
         a←{⍵⍴⍨2,⍨0.5×⍴⍵}a
         a←16⊥⍉a
         {⍵{(⍺{⍵⍴(⍵÷⍴⍺)↑1}⍴⍵)/⍵}82 ⎕DR ⍵}a
     }

And the other way around:

  • TextToHex←{
         a←83 ⎕DR ⍵
         a←1+,⍉16 16⊤a
         '0123456789ABCDEF'[a]
     }


CategoryDyalogUtils

HexAndText (last edited 2009-09-03 07:12:19 by anonymous)