parseHexDash

fun parseHexDash(hexDashString: String): Uuid(source)

Parses a uuid from the standard hex-and-dash string representation as described in Uuid.toHexDashString.

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

val uuid = Uuid.parseHexDash(hexDashString)
assertEquals(uuid.toHexDashString(), hexDashString.lowercase())

The standard textual representation of uuids, also known as hex-and-dash format, is specified by RFC 9562 section 4.

Since Kotlin

2.1

Return

A uuid equivalent to the specified uuid string.

Parameters

hexDashString

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 hexDashString is not a 36-character string in the standard uuid format.

Samples

import kotlin.test.*
import kotlin.uuid.*

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