BF2Statistics.Validator.IsAlphaOnly C# (CSharp) Method

IsAlphaOnly() public static method

This method determines if the given string contains characters only. Will return false if any numbers are in the string
public static IsAlphaOnly ( string line ) : bool
line string The string to be checked
return bool
        public static bool IsAlphaOnly(string line)
        {
            return Regex.IsMatch(line, @"^[a-z\s\t\n\r\n]+$", RegexOptions.IgnoreCase);
        }

Usage Example

 private void CmCountry_Validating(object sender, CancelEventArgs e)
 {
     if (!Validator.IsAlphaOnly(CmCountry.Text))
     {
         MessageBox.Show("Invalid format for Criteria > Country. Must contain letters only!", "Validation Error");
     }
 }