Ascii to integer

  • Thread starter Thread starter moni
  • Start date Start date
Actually, need to convert X to 88

and then back to string to display on a textbox.

Thanks..
 
Heres a function that will return the ascii values of each character in a
string, seperated by comma's
Adpapt at will:

private string ToASCIIIntInString(string instr)
{
char[] chars = instr.ToCharArray();
string[] asciis = new string[chars.Length];
int charCount = chars.Length;
for(int x;x<charCount;x++)
{
asciis[x] = ((int)chars[x]).ToString();
}

return string.Join(asciis, ", ");

}

HTH

Ciaran O'Donnell
 
string s = "X";
foreach(byte b in System.Text.ASCIIEncoding.ASCII.GetBytes(s))
Console.WriteLine(b);
 

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

ASCII to hex/binary 3
Stupid error with get/set on properties 5
ASCII Character Conversion 9
SSH library 2
Convert Binary Data to ASCII 6
EBCDIC to ASCII 2
Integer to Hex 5
ascii encoding 1

Back
Top