Convert letters into numbers
byte[] array = new BYTE[1]; Defines a set of array arrays
Array = System.Text.Encoding.ASCII.GetBytes (string); The letter of a string conversion
int asciicode = (short) (array[0]); /* Why ask Hovertree.com * *
ASCII code = convert.tostring (Asciicode); Converts an ASCII code to a string type
Convert numbers into letters
byte[] array = new BYTE[1];
Array[0] = (byte) (Convert.ToInt32 (ASCII code)); ASCII forced conversion binary
Converted letter = convert.tostring (System.Text.Encoding.ASCII.GetString (array));
Many times in the coding process will be used to convert certain numbers of index into letters, such as Excel cells in the number of columns in Excel in uppercase letters, to be converted to letters can use C # ASCIIEncoding class in the GetString method. See the following example:
/// ///number to letter/// ///number to convert to letters (number range in closed interval [65,90])/// Private stringNuntochar (intNumber ) { if( $<= number && ->=Number ) {System.Text.ASCIIEncoding ASCIIEncoding=NewSystem.Text.ASCIIEncoding (); byte[] Btnumber =New byte[] { (byte) Number}; returnasciiencoding.getstring (Btnumber); } return "the number is not within the conversion range";} /// ///convert,..., 35,36 to a,b,c,..., y,z/// ///number to convert to letters (number range in closed interval [1,36])/// Private stringNunbertochar (intNumber ) { if(1<= number && $>=Number ) { intnum = number+ -; System.Text.ASCIIEncoding asciiencoding=NewSystem.Text.ASCIIEncoding (); byte[] Btnumber =New byte[] { (byte) num}; returnasciiencoding.getstring (Btnumber); } return "the number is not within the conversion range";}/*how to ask Hovertree.com*/
Recommendation: http://www.cnblogs.com/roucheng/p/netkuangjia.html
C # simple alpha-numeric ASCII code conversion