Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字节数组:
evenParityASCII[0] = 0xB1; // 1 evenParityASCII[1] = 0xB2; // 2 evenParityASCII[2] = 0x33; // 3 evenParityASCII[3] = 0xB4; // 4 evenParityASCII[4] = 0x35; // 5
我需要将这些转换为普通的 ASCII。有没有一种简单的方法可以做到这一点?
你在找System.Text.Encoding吗?
System.Text.Encoding
for (int i = 0; i < evenParityASCII.Length; i++) { evenParityASCII[i] = (byte)(evenParityASCII[i] & 0x7F); } string myAscii = System.Text.Encoding.ASCII.GetString(evenParityASCII);