I have a string that contains a 15 digit account number. The first digit cannot be a 0,1, 8 or 9. I want to say something like:
public bool ValidateAccountNumber(string Accountnumber )
{
char[] Invalidboro = new char[] { '0', '1', '8', '9'};
bool returnValue = true;
if (Accountnumber.Length != 15 || Accountnumber.Substring(1, 1).Contains(Invalidboro))
{
returnValue = false;
}
return returnValue;
}
I'm new to C# and not sure how to do this.