validate
Validates an Indian mobile number.
Input normalisation applied before validation (in order):
Trim leading/trailing whitespace
Strip
+91prefix (if present)Strip a single leading
0(if present after step 2)Strip all remaining spaces and hyphens
After normalisation, checks are applied in this order — first failing check wins:
InvalidReason.EMPTY if the result is blank
InvalidReason.WRONG_LENGTH if digit count is not 10
InvalidReason.INVALID_FORMAT if any non-digit character remains
InvalidReason.INVALID_PREFIX if the first digit is not 6, 7, 8, or 9
Edge cases:
"+910876543210"→ strip+91→"0876543210"→ strip leading0→"876543210"(9 digits) → InvalidReason.WRONG_LENGTH"00876543210"→ no+91prefix → strip one leading0→"0876543210"(10 digits, starts with0) → InvalidReason.INVALID_PREFIX"0876543210"→ strip leading0→"876543210"(9 digits) → InvalidReason.WRONG_LENGTH
Return
ValidationResult.Valid if the number is a valid 10-digit Indian mobile, ValidationResult.Invalid with an appropriate InvalidReason otherwise.
Parameters
Raw mobile number string in any common Indian format.
Samples
check(Mobile.validate("9876543210") == ValidationResult.Valid)
check(Mobile.validate("+91 98765 43210") == ValidationResult.Valid)