Solved

How to convert a alpha numeric string into Hex

Posted on 2009-07-13
6
805 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…

624 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