Credit Card Validator
The CreditCardValidator
class is used to validate credit card numbers. It has two methods, isCreditCardValid
and identifyCreditCard
.
import io.github.multiform_validator.CreditCardValidator;
public class Main {
public static void main(String[] args) {
valid();
invalid();
}
private static void valid() {
System.out.println(CreditCardValidator.isCreditCardValid("4532 8770 0040 4166")); // true
}
private static void invalid() {
System.out.println(CreditCardValidator.isCreditCardValid("4532 8770 0040 4167")); // false
}
}
import io.github.multiform_validator.CreditCardValidator;
public class Main {
public static void main(String[] args) {
String creditCard = "4532 8770 0040 4166";
System.out.println(CreditCardValidator.identifyCreditCard(creditCard)); // Visa
}
}