Ascii to integer

M

moni

Actually, need to convert X to 88

and then back to string to display on a textbox.

Thanks..
 
G

Guest

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
 
S

S Kachru

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
Convert Binary Data to ASCII 6
SSH library 2
Integer to Hex 5
ascii encoding 1
EBCDIC to ASCII 2
Help Me convert Ascii to Base64 2

Top