Advertisement
Archon

isLetter

Aug 5th, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. int isLetter(int *c){
  2.    static int upperLowerDiff = 'a' - 'A';
  3.  
  4.    //A-Z: make lower-case and return 1
  5.    if (*c <= 'Z' && *c >= 'A'){
  6. #ifndef CASE_SENSITIVE
  7.       *c += upperLowerDiff;
  8. #endif
  9.       return 1;
  10.    }
  11.  
  12.    //a-z, apostrophe: return 1
  13.    if (*c >= 'a' && *c <= 'z' || *c == '\'')
  14.       return 1;
  15.  
  16.    //non-letter: return 0
  17.    return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement