parse

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.

Since Kotlin

2.0

Return

A uuid equivalent to the specified uuid string.

Parameters

uuidString

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

See also

Throws

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

Samples

import kotlin.uuid.*

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