convert HEX string into integer

?

:)

Hi all:

I have a HEX string such as 0x0010026AB0, I can I convert it into an
integer in C#. Does it have some build-in function.

Thanks in advance.
 
A

AlanT

You can use the Int32.Parse() method if you drop off the leading "0x"

e.g.
string val = "0010026AB0";
int inVal = System.Int32.Parse(val,
System.Globalization.NumberStyles.AllowHexSpecifier);
MessageBox.Show(inVal.ToString());

hth,
Alan.
 
M

Markus Stoeger

:) said:
Hi all:

I have a HEX string such as 0x0010026AB0, I can I convert it into an
integer in C#. Does it have some build-in function.

If you could remove the leading 0x you could use:

int a = int.Parse("10026AB0", NumberStyles.AllowHexSpecifier);

hth,
Max
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top