Skip to content

Instantly share code, notes, and snippets.

@OrigamiTech
Created December 7, 2010 21:57
Show Gist options
  • Save OrigamiTech/732499 to your computer and use it in GitHub Desktop.
Save OrigamiTech/732499 to your computer and use it in GitHub Desktop.
to detect if a character is a letter or not.
if ((((((((((((((((((((((((((((((((((((((((((((((((((((ch == 'A') | (ch == 'B')) | (ch == 'C')) | (ch == 'D')) | (ch == 'E')) | (ch == 'F')) | (ch == 'G')) | (ch == 'H')) | (ch == 'I')) | (ch == 'J')) | (ch == 'K')) | (ch == 'L')) | (ch == 'M')) | (ch == 'N')) | (ch == 'O')) | (ch == 'P')) | (ch == 'Q')) | (ch == 'R')) | (ch == 'S')) | (ch == 'T')) | (ch == 'U')) | (ch == 'V')) | (ch == 'W')) | (ch == 'X')) | (ch == 'Y')) | (ch == 'Z')) | (ch == 'a')) | (ch == 'b')) | (ch == 'c')) | (ch == 'd')) | (ch == 'e')) | (ch == 'f')) | (ch == 'g')) | (ch == 'h')) | (ch == 'i')) | (ch == 'j')) | (ch == 'k')) | (ch == 'l')) | (ch == 'm')) | (ch == 'n')) | (ch == 'o')) | (ch == 'p')) | (ch == 'q')) | (ch == 'r')) | (ch == 's')) | (ch == 't')) | (ch == 'u')) | (ch == 'v')) | (ch == 'w')) | (ch == 'x')) | (ch == 'y')) | (ch == 'z')) { /*code*/ }
@OrigamiTech
Copy link
Author

alternatively:
if (Regex.Match(ch.ToString(), "^[a-zA-Z]$").Success)
{
/code/
}

@BenWoodford
Copy link

Ian will love this I'm sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment