Here is a table that summarizes the ASCII codes for the characters you can type on the keyboard.
0 1 2 3 4 5 6 7 8 9 30 | ! " # $ % & ' 40 | ( ) * + , - . / 0 1 50 | 2 3 4 5 6 7 8 9 : ; 60 | < = > ? @ A B C D E 70 | F G H I J K L M N O 80 | P Q R S T U V W X Y 90 | Z [ \ ] ^ _ ` a b c 100 | d e f g h i j k l m 110 | n o p q r s t u v w 120 | x y z { | } ~The first character actually in the table is code 32 which is a space character. Codes 30 and 31 are for characters the keyboard doesn't generate. The last code is 126. The last 3 in the chart are characters they keyboard doesn't generate. As some examples of reading this table, the letter 'A' has a code of 65 and the letter 'a' has a code of 97. Notice the codes for the upper case letters are all smaller than the codes for the lower case letters. Notice also that the codes for the digits are consecutive and come before both the lower and upper case letters. This will help us figure out how to order strings.
You do not need to memorize these codes. You just need to know some basic properties about the code as mentioned above. If you need to know a particular code you can look it up. You can also use some Turing functions.
Now we can look at how strings are ordered. The same approach is used that would be used to find a word in a dictionary with one exception. Upper case and lower case letters are different and upper case letters come first. The ASCII code is used to determine the order of characters. It is often a good idea to convert strings to all upper case or all lower case before comparing them. We'll look at how to do this a bit later in this section.
|
Caitlin Smith comes before caitlin jones s is now -> caitlin smith caitlin jones comes before caitlin smith |
|