Hex to String

I am trying to convert a Hex string to a character string. The value is being converted to Hexidecimal by the Hex() function but I have been unable to find a similar function to convert it back from Hexidecimal to String. Could anyone shed any light?

The code used to "encode" it is:

 For Each sChar In Value
                sRet += Hex(Asc(sChar)).ToString
Next


Example:

I have this string:

546869732069732061207465737421

and I want to convert it back to the original string:

This is a test!




Thanks,

M@
LVL 4
willcode4coffeeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

eekjCommented:
Dim OutStr As String = Hex(Int32.Parse("546869732069732061207465737421"))
0
eekjCommented:
whoops i didnt read your question properly... duh
0
willcode4coffeeAuthor Commented:
No problem. I can find lots of examples of how to get it to hex, but none on how to get it back.

M@
0
eekjCommented:
Dim before As String = "546869732069732061207465737421"
Dim ret As String = ""
Dim i As Int16 = 0

For i = 0 To before.Length - 1
     ret = ret + (ChrW(Integer.Parse(before.Substring(i, 2), System.Globalization.NumberStyles.HexNumber)))
     i = i + 1
 Next
 MsgBox(ret)

"This is a Test!"
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

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.