-4

I think the title says enough.

void onClickSubmit(char submit)
{
     if(submit.//check if it is alphabetical)
     {
           //some code
     }
}

how can i check if the char submit is in the alphabet?

Br4m3000
  • 53
  • 1
  • 2
  • 6
  • 8
    What do you consider your alphabet? Is it just anything `[a-zA-Z]`? Or do you have a special alphabet? – wkl Jan 05 '16 at 16:06
  • 2
    Or any letter character [`Char.IsLetter()`](https://msdn.microsoft.com/en-us/library/yyxz6h5w(v=vs.110).aspx)? – ryanyuyu Jan 05 '16 at 16:07
  • 5
    Did you bother Googling/researching this *at all* before asking? What have you actually tried? – tnw Jan 05 '16 at 16:08
  • Possible duplicate of [how to check first character of a string if a letter, any letter](http://stackoverflow.com/questions/3560393/how-to-check-first-character-of-a-string-if-a-letter-any-letter) – Rotem Jan 05 '16 at 16:11
  • Is Ы part of your alphabet? And ㅂ? Not so *obvious*, maybe. – Adriano Repetti Jan 05 '16 at 16:14

2 Answers2

6

You can use regex if your alphabet are only A-Z or a-z

char a = 'A';
bool isAlphaBet = Regex.IsMatch(a.ToString(), "[a-z]", RegexOptions.IgnoreCase);
if(isAlphaBet )
{
    //do this..
}
sm.abdullah
  • 1,777
  • 1
  • 17
  • 34
0

To support any UTF-8 Letter

var rgx = new Regex(@"[\p{L}]");
Console.Write(rgx.Match("Ö").Success);
tenbits
  • 7,568
  • 5
  • 34
  • 53