validate

Validates a GSTIN.

Input normalisation applied before validation (in order):

  1. Trim leading/trailing whitespace

  2. Strip all internal whitespace (covers copy-paste with spaces)

  3. Uppercase all characters

After normalisation, checks are applied in this order — first failing check wins:

Never throws. Returns ValidationResult.Invalid for all invalid inputs.

Return

ValidationResult.Valid if the GSTIN passes all checks, ValidationResult.Invalid with an appropriate InvalidReason otherwise.

Parameters

value

Raw GSTIN string in any common input form.

Samples

check(GSTIN.validate("27AAPFU0939F1ZV") == ValidationResult.Valid)