Solved

How to convert a alpha numeric string into Hex

Posted on 2009-07-13
6
783 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 18

Expert Comment

by:Ajay Sharma
ID: 24839004
0
 
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
Gigs: Get Your Project Delivered by an Expert

Select from 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.

 

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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from 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.

Question has a verified solution.

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

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now