part of the alphabet

Is there a prewritten funtion that I can use to check if a string only contains the english alphabet


Answer this question

part of the alphabet

  • PublicError

    unfortunately not that I can see, you would have to create your own.

  • erick_the_redd

    I'd definitely go with the Regular Expression.

  • Armela

    You may be able to use regular expressions. Check this out:

    http://msdn2.microsoft.com/en-us/library/20bw873z.aspx


  • andreyr123

    Moved from windows forms.

  • quiklearner

    Hi,

    by regular expression,



    Regex re = new Regex(@"^[a-zA-Z]*$");
    if (re.IsMatch("Hello"))
    {
    // do something
    }

    Hope this helps.



  • Jabber

    a bit longer, but probably faster method is:

    foreach(Char c in str)
    if (!Char.IsLetter(c))
    return false;
    return true;



  • part of the alphabet