hex to string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Net Mongrel

    hex to string

    converting string to hex like so:

    for x = 1 to len(source)
    target = target & hex(ascw(mid(so urce,x,1)))
    next

    How to convert it back to a string?

    I got as far as:

    for x = 1 to len(source) step 2
    target = target & chr("&H" & mid(source,x,2) )
    next

    but this fails with the pound sign (£ - £)

    --
    Net


  • Stan Scott

    #2
    Re: hex to string

    Can't you just use the escape() and unescape() methods? These convert to
    hex and back.

    Stan Scott
    New York City

    "Net Mongrel" <netmongrel@blu eyonder.co.uk> wrote in message
    news:9TZLc.5980 $AI5.60994688@n ews-text.cableinet. net...[color=blue]
    > converting string to hex like so:
    >
    > for x = 1 to len(source)
    > target = target & hex(ascw(mid(so urce,x,1)))
    > next
    >
    > How to convert it back to a string?
    >
    > I got as far as:
    >
    > for x = 1 to len(source) step 2
    > target = target & chr("&H" & mid(source,x,2) )
    > next
    >
    > but this fails with the pound sign (£ - &pound;)
    >
    > --
    > Net
    >
    >[/color]


    Comment

    • Net Mongrel

      #3
      Re: hex to string

      Stan Scott wrote:[color=blue]
      > "Net Mongrel" <netmongrel@blu eyonder.co.uk> wrote in message
      > news:9TZLc.5980 $AI5.60994688@n ews-text.cableinet. net...[color=green]
      >> converting string to hex like so:
      >>
      >> for x = 1 to len(source)
      >> target = target & hex(ascw(mid(so urce,x,1)))
      >> next
      >>
      >> How to convert it back to a string?
      >>
      >> I got as far as:
      >>
      >> for x = 1 to len(source) step 2
      >> target = target & chr("&H" & mid(source,x,2) )
      >> next
      >>
      >> but this fails with the pound sign (£ - &pound;)
      >>[/color]
      > Can't you just use the escape() and unescape() methods? These
      > convert to hex and back.
      >[/color]

      Thanks Stan, that's javascript right? I did a little digging and played
      around with the calls. They don't really do what I had in mind.

      I do need to get the hex pairs for each character and then change them back.

      --
      Net


      Comment

      Working...