format

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

Formats a valid AadhaarVID to the canonical spaced form.

Output: "XXXX XXXX XXXX XXXX" — four groups of 4 digits separated by spaces. Example: "2345678901234561""2345 6789 0123 4561".

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

Return

Canonical 4-group-spaced VID string.

Parameters

value

Raw VID string in any common input form.

Throws

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

Samples

val vid = "2345678901230000"
println(AadhaarVID.format(vid)) // "2345 6789 0123 0000" (only if Verhoeff valid)