Search code examples
ascii

Double Quotes in ASCII


What is the ASCII number for the double quote? (")

Also, is there a link to a list anywhere?

Finally, how do you enter it in the C family (esp. C#)


Solution

  • The ASCII code for the quotation mark is 34.

    There are plenty of ASCII tables on the web. Note that some describe the standard 7-bit ASCII code, while others describe various 8-bit extensions that are super-sets of ASCII.

    To put quotation marks in a string, you escape it using a backslash:

    string msg = "Let's just call it a \"duck\" and be done with it.";
    

    To put a quotation mark in a character literal, you don't need to escape it:

    char quotationMark = '"';
    

    Note: Strings and characters in C# are not ASCII, they are Unicode. As Unicode is a superset of ASCII the codes are still usable though. You would need a Unicode character table to look up some characters, but an ASCII table works fine for the most common characters.