parse

Common
JVM
JS
Native
1.0
fun parse(uuidString: String): Uuid
(source)

Parses a uuid from the standard string representation as described in Uuid.toString.

This function is case-insensitive, and for a valid uuidString, the following property holds:

val uuid = Uuid.parse(uuidString)
assertEquals(uuid.toString(), uuidString.lowercase())

The standard textual representation of uuids is specified by RFC 9562 section 4.

import kotlin.uuid.*

fun main(args: Array<String>) {
//sampleStart
val uuid = Uuid.parse("550E8400-e29b-41d4-A716-446655440000") // case insensitive
println(uuid) // 550e8400-e29b-41d4-a716-446655440000
//sampleEnd
}

Parameters

uuidString - A string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", where each 'x' is a hexadecimal digit, either lowercase or uppercase.

Exceptions

IllegalArgumentException - If the uuidString is not a 36-character string in the standard uuid format.

Return A uuid equivalent to the specified uuid string.

See Also

Uuid.toString