format

fun format(value: String): String(source)

Formats a valid Aadhaar number to the UIDAI canonical spaced form.

Output: "XXXX XXXX XXXX" — three groups of 4 digits separated by spaces. Example: "234567890121""2345 6789 0121".

Input is normalised (whitespace stripped) before formatting. This method is idempotent: format(format(x)) == format(x).

Return

Canonical UIDAI-spaced Aadhaar string.

Parameters

value

Raw Aadhaar string in any common input form.

Throws

if value is not a valid Aadhaar number. The exception message includes the (truncated) input for diagnostics.

Samples

check(Aadhaar.format("234567890124") == "2345 6789 0124")