• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 814
  • Last Modified:

How to convert a alpha numeric string into Hex

I have a alpha numeric serial number "0013a200402c4bca" and I want to convert it into hex?
any ideas?
1 Solution
Jaime OlivaresSoftware ArchitectCommented:
Try with the following:

Dim test as String = "0013a200402c4bca"
Dim num as Int64
num = Convert.ToInt64(test, 16)
Jaime OlivaresSoftware ArchitectCommented:
Notice that a regular Integer (Int32) cannot contain such large number.
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

cmdolcetAuthor Commented:
jaime_olivares, the alpha string im trying to convert i want it in an array

so the string"0013a200402c4bca"
how can i break this up into array section
(0) = 00

then convert this to hex value?
Sorry i should have been clear when i originally asked the question
That value is already in hex. It is an 8 bytes int64  if you want to get the value of it numerically you can use something like this.

Dim result As Int64 = Int64.Parse("0013a200402c4bca", Globalization.NumberStyles.HexNumber)

Open in new window

You can also use bitconverter to break the number back into the hex string
BitConverter.ToString(BitConverter.GetBytes(result), 0))

Open in new window

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.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now