I am doing a fuction where I want to check that a String contains only Letters between: "A-Z" and Numbers between: "0-9" and "_"
Instead of checking all one by one. Is there any approach to check against all at the same time ?
String ThisString= TextBox1.Text.Trim().ToLower();
for (int i = 0; i < ThisString.Length; i++)
{
if( ThisString.Substring(i, 1) == ??? )
{
//Found a valid character so go on with code
}
}