GetAsciiCharacter

mail@pastecode.io avatar
unknown
csharp
2 years ago
905 B
1
Indexable
Never
 static void Main(string[] args)
        {
            Console.WriteLine("Herfi daxil edin.");
            byte[] characters = Encoding.ASCII.GetBytes(Console.ReadLine());
            Console.WriteLine();
            byte[] previous = { Convert.ToByte(characters[0] - 1) };

            char[] previousCharacter = Encoding.ASCII.GetChars(previous);

            Console.WriteLine($"Evvelki simvol: {previousCharacter[0]}");

            byte[] next = { Convert.ToByte(characters[0] + 1)};

            char[] nextCharacter = Encoding.ASCII.GetChars(next);

            Console.WriteLine($"Sonrakı simvol: {nextCharacter[0]}");
            //char lastCharacter = Encoding.ASCII.GetString(selectedCharacter);
            //string s = "BA";
            //byte[] data = { 65, 66 };

            //var data2 =  Encoding.ASCII.GetChars(data);


            Console.ReadLine();
        }