Conversion of hex pairs to chars...best way?
    T. R. Ponn 
    alptex2 at orwell.net
       
    Thu May 22 11:55:00 EDT 2003
    
    
  
Hello!
Here's something I've done MANY times with HC over the years and I'm 
hoping there's a less time consuming way to accomplish it with Rev:
I have the need to convert mass quantities of lines of data in this form:
"5265766F6C7574696F6E", as an example.  They are pairs (base16) of:
"82_101_118_111_108_117_116_105_111_110", in base10 (underscores added 
here for clarification).  And they become:
"Revolution" in ASCII chars.
Now what I've *been* doing in Rev is something akin to:
put empty into whatEverOut
put "5265766F6C7574696F6E" into whatEver
  repeat with i=1 to the number of chars of whatEver
    put numToChar(baseConvert((char ((i*2)-1) to (i*2) of 
whatEver),16,10)) after whatEverOut
  end repeat
put whatEverOut
Is this a good way to do this, or is there something that can be done 
with a "repeat for each" form?  This ( similar) is used soooooo much in 
my app that it's bound to make a significant difference.  Oh...and 
occasionally I have to do this routine "in reverse".
Thanks in advance for any ideas you have!
Best Regards,
Tim Ponn
    
    
More information about the use-livecode
mailing list