Search code examples
c#stringascii

How to convert a string to ASCII


How do I convert each letter in a string to its ASCII character value?


Solution

  • For Any String try this:

    string s = Console.ReadLine();
    foreach( char c in s)
    {
        Console.WriteLine(System.Convert.ToInt32(c));
    }
    Console.ReadKey();