convert an ascii string number to a decimal number ?
Hi all,
From a UART connection I´m getting the following string "/XCC0001011111111111" and i need to discard the "/XCC00" part and convert the ascii code "01011111111111" to a dicimal or hex number.
But i don´t know how to do this - so please help me :-)
Kirtan PatelPosted Aug 30, 2009, 12:22 AM
dont forget to mark "Do you like answer" please it will give me some credits :)
private void button1_Click(object sender, EventArgs e)
{
//Replace /xcc00 with Blank
string x = textBox2.Text.Trim().Replace("/XCC00",string.Empty);
//Convert Remaining Part to Hex
string Hex = Convert.ToString(Convert.ToInt32(x, 2), 16);
//Show in Message Box
MessageBox.Show(Hex);
}