M moni Sep 11, 2006 #2 Actually, need to convert X to 88 and then back to string to display on a textbox. Thanks..
G Guest Sep 11, 2006 #3 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
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 Sep 11, 2006 #4 string s = "X"; foreach(byte b in System.Text.ASCIIEncoding.ASCII.GetBytes(s)) Console.WriteLine(b);
? =?ISO-8859-1?Q?Arne_Vajh=F8j?= Sep 11, 2006 #5 moni said: Actually, need to convert X to 88 Click to expand... char c = 'X'; int i = (int)c; char c2 = (char)i; should work. Arne
moni said: Actually, need to convert X to 88 Click to expand... char c = 'X'; int i = (int)c; char c2 = (char)i; should work. Arne
C Chris Mullins Sep 12, 2006 #6 moni said: I need to convert X to 88, Can some1 tell me. Click to expand... int x = Convert.ToInt32(x); string s = x.ToString();
moni said: I need to convert X to 88, Can some1 tell me. Click to expand... int x = Convert.ToInt32(x); string s = x.ToString();