format

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

Formats a valid Driving License number to its canonical form.

Output: uppercase string with no separator (14 or 15 characters). Example: "mh12-20110012345""MH1220110012345".

The Sarathi Parivahan portal has no official display separator convention — no-separator canonical form is unambiguous and idempotent.

Applies the same normalisation as validate (trim + strip whitespace + strip hyphens + uppercase) before formatting. Throws IllegalArgumentException if the input is not a valid DL.

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

Return

Canonical uppercase no-separator DL string (14 or 15 characters).

Parameters

value

Raw DL string in any common input form.

Throws

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

Samples

println(DL.format("MH0120230012345"))