Originally Posted by
matsp
I use "isprint()" to see if something is a valid character, rather than checking ascii values. It is better out of two perspectives:
1. it allows any printable character, which is probably what you want - even if they aren't in the original ascii table, such as ä, å etc. No reason NOT to allow those.
2. It is much more straight forward a check than the two numeric values you use, and doesn't need any explanation to anyone else reading the code that may not be quite so clued up on ascii characters.
3. [For the benefit of the pedants that like pointing these things out] it works for other character sets than ASCII.