[C #] Character transfer ASCII code, ASCII code turnt characters

xiaoxiao2021-04-07  325

Character transfer ASCII code:

public static int Asc (string character) {if (character.Length == 1) {System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding (); int intAsciiCode = (int) asciiEncoding.GetBytes (character) [0] Return (INTASCIicode);} else {throw new exception ("Character Is Not Valid.");

}

ASCII code turnt character:

public static string Chr (int asciiCode) {if (asciiCode> = 0 && asciiCode <= 255) {System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding (); byte [] byteArray = new byte [] {(byte ASCIICODE}; string stranding.getstring (ByteArray); Return (STRCHARACTER);} else {throw new exception ("ASCII Code Is Not Valid.");}}

转载请注明原文地址:https://www.9cbs.com/read-132402.html

New Post(0)