|
// retoor <retoor@molodetz.nl>
|
|
|
|
import "uuid" for Uuid
|
|
|
|
System.print("=== UUID Module Demo ===")
|
|
|
|
System.print("\n--- Generating UUIDs ---")
|
|
for (i in 1..5) {
|
|
System.print("UUID %(i): %(Uuid.v4())")
|
|
}
|
|
|
|
System.print("\n--- UUID Validation ---")
|
|
var testUuid = Uuid.v4()
|
|
System.print("Generated: %(testUuid)")
|
|
System.print("isValid: %(Uuid.isValid(testUuid))")
|
|
System.print("isV4: %(Uuid.isV4(testUuid))")
|
|
|
|
System.print("\n--- Invalid UUID Examples ---")
|
|
var invalidUuids = [
|
|
"invalid",
|
|
"550e8400-e29b-41d4-a716",
|
|
"550e8400-e29b-41d4-a716-44665544000X",
|
|
123
|
|
]
|
|
for (uuid in invalidUuids) {
|
|
System.print("%(uuid): isValid = %(Uuid.isValid(uuid))")
|
|
}
|