I'm supposed to check requirements of a string, and if all requirements are met, it should return true
if not, then false
.
The requirements are:
- It must be 8 characters long
- It must have one BIG letter
- It must contain characters from 0 to 9
This is my:
public bool Check(string s)
{
string buchstaben = "QWERTZUIOPÜASDFGHJKLÖÄYXCVBNM";
string ziffern = "0123456789";
foreach (char _c in s)
{
if (ziffern.Contains(_c) && buchstaben.Contains(_c) && s.Length == 8)
{
return true;
}
}
return false;
}
It returns somehow always false
.