jcbCard static method
Validates whether the given cardNumber
is a valid JCB card number.
The cardNumber
parameter should be a string representing a JCB card number.
Returns true
if the cardNumber
is valid, false
otherwise.
Implementation
static bool jcbCard(String cardNumber) {
String pattern = r'^(?:2131|1800|35\d{3})\d{11}$';
RegExp regExp = RegExp(pattern);
return regExp.hasMatch(cardNumber);
}