Re: sequence conversion

new topic     » goto parent     » topic index » view thread      » older message » newer message

Hi Wolf,

>How do I convert something like this...
>sequence hex
>hex = { A, 3, 2, E, B }
>... to this ?
>sequence ascii
>ascii = "A32EB"

Your sequence hex isn't a valid sequence.

Do you mean:
A.  hex = { 'A', '3', '2', 'E', 'B' }, or
B.  hex = { 10, 3, 2, 15, 11 }

If you mean B then it is already an "ascii" format.
Actally there is no ascii format just sequences.

If you mean A then you can start with an empty sequence
and loop through converting each element of hex to its
corresponding value in ascii.

one long (untested) way of doing it would be:

   ascii = ""
   for i = 1 to length(hex) do
      if hex[i] = 1 then ascii = append(ascii, 1)
      elsif hex[i] = 2 then ascii = append(ascii, 2)
      ...
   end for

Ray Smith

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu