Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to convert a alpha numeric string into Hex

Posted on 2009-07-13
6
Medium Priority
?
811 Views
Last Modified: 2012-05-07
I have a alpha numeric serial number "0013a200402c4bca" and I want to convert it into hex?
any ideas?
0
Comment
Question by:cmdolcet
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 24839021
Try with the following:

Dim test as String = "0013a200402c4bca"
Dim num as Int64
num = Convert.ToInt64(test, 16)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 24839029
Notice that a regular Integer (Int32) cannot contain such large number.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cmdolcet
ID: 24839152
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
(1)=13
(2)=a2
(3)=00
(4)=40
(5)=2c
(6)=4b
(7)=ca

then convert this to hex value?
Sorry i should have been clear when i originally asked the question
0
 
LVL 8

Expert Comment

by:bhmahler
ID: 24840719
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

0
 
LVL 8

Accepted Solution

by:
bhmahler earned 2000 total points
ID: 24840769
You can also use bitconverter to break the number back into the hex string
BitConverter.ToString(BitConverter.GetBytes(result), 0))

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question