Convert ascii values to character within string

Experts, I need help searching through a string and converting ascii hex values to characters. Below is the string i need to parse. The ascii hex values are preceeded by % and I need to replace this with the character value. For example in the &email tag I need to replace %40 with @.


string contents:
dim str as string
-----------------------------------------------------
str = customer_id=255349&authorized=no&first_name=test&last_name=order&phone=5618662933&email=test%40test.com&product=50&username=&password=&shipping_address=1124+apollo+rd&shipping_unit=1124+apollo+rd&shipping_city=Melbourne&shipping_state=FL&shipping_zip=32935&shipping_country=US&billing_address=1124+apollo+rd&billing_unit=1124+apollo+rd&billing_city=Melbourne&billing_state=FL&billing_zip=32935&billing_country=US&cc_number=5454545454545454&cc_expires=2011-05-30+23%3A59%3A59&cc_name_on_account=test+order&cc_ccid=123
DalexanAsked:
Who is Participating?
 
GrahamSkanConnect With a Mentor RetiredCommented:
Not efficient, but it works:

For i = 0 To 255
    str = Replace(str, "%" & Right$("0" & Hex$(i), 2), Chr$(i))
Next i
0
 
DalexanAuthor Commented:
This is cutting off the end of the string at position 425? It is changing what it leaves to the character code.
0
 
GrahamSkanRetiredCommented:
Do you still have a truncating problem. I can't reproduce it myself?
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
DalexanAuthor Commented:
Rather than breakdown the whole string im going to try parsing the tags which should work. You might be able to answer my other question though

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21926303.html
0
 
GrahamSkanRetiredCommented:
Thanks. I have seen it and contributed. It looks like the gang has arrived.
0
 
DalexanAuthor Commented:
I will be awarding points shortly
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.