Class CreditCardValidator

java.lang.Object
io.github.multiform_validator.CreditCardValidator

public class CreditCardValidator extends Object
  • Method Details

    • isCreditCardValid

      public static boolean isCreditCardValid(String creditCard)
      Validates a credit card number.
      Parameters:
      creditCard - The credit card number to validate.
      Returns:
      true if the credit card number is valid, false otherwise.
      Throws:
      IllegalArgumentException - if the input value is null or empty.
    • identifyFlagCard

      public static String identifyFlagCard(String cardNumber)
      Identifies the flag of a credit card based on its number.
      Parameters:
      cardNumber - The credit card number.
      Returns:
      The flag of the credit card, or "Unknown" if the flag is not recognized.
      Throws:
      IllegalArgumentException - if the input value is null or empty.