format

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

Formats a vehicle registration to canonical form: uppercase, no separators.

Applies the same normalisation as validate (trim + strip whitespace + strip hyphens + uppercase) before formatting. No single display separator standard exists for Indian vehicle plates — the canonical output is uppercase with no separators.

Examples:

  • "mh12ab1234""MH12AB1234"

  • "MH 12 AB 1234""MH12AB1234"

  • "MH-12-AB-1234""MH12AB1234"

  • "MH12AB1234""MH12AB1234" (idempotent)

This method is idempotent: format(format(x)) == format(x) for any valid x.

Return

Canonical uppercase vehicle registration string (8–11 characters, no separators).

Parameters

value

Raw vehicle registration string.

Throws

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

Samples

check(VehicleRC.format("mh01ab1234") == "MH01AB1234")