format

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

Formats a Passport number to canonical form: 8-character uppercase, no separators.

Applies the same normalisation as validate before formatting. The MEA publishes no display separator convention — output is the raw uppercase string: e.g. "M1234567".

This method is idempotent: format(format(x)) == format(x).

Return

Canonical 8-character uppercase Passport number string.

Parameters

value

Raw Passport number string.

Throws

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

Samples

check(Passport.format("a1234567") == "A1234567")