ASCII Codes


There was a time when every book on programming had a table of ASCII codes as an appendix. The ASCII codes (American Standard Code for Information Interchange) used the numbers from 32 to 127 to represent characters of the English alphabet.

The tables were included in the books because it was impossible to do much in the way of programming without referring to ASCII codes. Modern high-level languages do not rely on these codes as heavily but there are still times when you might use them to:
  • Read information from a file in an unusual format
  • Encrypt or decrypt a password
  • Produce a character which is not on your keyboard
  • Produce a character (typically a quote) which would cause a syntax error if types explicitly.
Access and FoxPro both use the same names for the functions which manipulate ASCII:

Asc(number) returns the character with that ASCII code.
Chr(character) returns the ASCII code of that character.

Table of ASCII codes

This table lists the decimal and hexadecimal codes for the characters. The Asc() and Chr() functions both work with decimal values but if you are reading from a binary file then you will need the hexadecimal values.

Dec Hex Char   Dec Hex Char   Dec Hex Char
32 20 (space)   64 40 @   96 60 `
33 21 !   65 41 A   97 61 a
34 22 "   66 42 B   98 62 b
35 23 #   67 43 C   99 63 c
36 24 $   68 44 D   100 64 d
37 25 %   69 45 E   101 65 e
38 26 &   70 46 F   102 66 f
39 27 '   71 47 G   103 67 g
40 28 (   72 48 H   104 68 h
41 29 )   73 49 I   105 69 i
42 2a *   74 4a J   106 6a j
43 2b +   75 4b K   107 6b k
44 2c ,   76 4c L   108 6c l
45 2d -   77 4d M   109 6d m
46 2e .   78 4e N   110 6e n
47 2f /   79 4f O   111 6f o
48 30 0   80 50 P   112 70 p
49 31 1   81 51 Q   113 71 q
50 32 2   82 52 R   114 72 r
51 33 3   83 53 S   115 73 s
52 34 4   84 54 T   116 74 t
53 35 5   85 55 U   117 75 u
54 36 6   86 56 V   118 76 v
55 37 7   87 57 W   119 77 w
56 38 8   88 58 X   120 78 x
57 39 9   89 59 Y   121 79 y
58 3a :   90 5a Z   122 7a z
59 3b ;   91 5b [   123 7b {
60 3c <   92 5c \   124 7c |
61 3d =   93 5d ]   125 7d }
62 3e >   94 5e ^   126 7e ~
63 3f ?   95 5f _   127 7f DEL

Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map