dinersClubCard static method
Validates whether the given cardNumber
is a valid Diners Club card number.
The cardNumber
parameter should be a string representing a Diners Club card number.
Returns true
if the cardNumber
is valid, false
otherwise.
Implementation
static bool dinersClubCard(String cardNumber) {
String pattern = r'^3(?:0[0-5]|[68][0-9])[0-9]{11}$';
RegExp regExp = RegExp(pattern);
return regExp.hasMatch(cardNumber);
}