Sample code for 30+ languages & platforms
PowerBuilder

Validate a ULID

See more ULID/UUID Examples

Checks to see if a ULID is valid.

Important: Chilkat's ULID functionality was introduced in v9.5.0.94.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
oleobject loo_Dt
string ls_Ulid
integer li_Valid

loo_Dt = create oleobject
li_rc = loo_Dt.ConnectToNewObject("Chilkat.CkDateTime")
if li_rc < 0 then
    destroy loo_Dt
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// A ULID must be exactly 26 chars in length,
// and is composed of the following chars: 0123456789ABCDEFGHJKMNPQRSTVWXYZ
// Note: The ULID alphabet excludes the letters I, L, O, and U

// Here's a valid ULID
ls_Ulid = "01GRGCH4J88RECEN4D4VK4F629"
li_Valid = loo_Dt.UlidValidate(ls_Ulid)
Write-Debug "valid: " + string(li_Valid)

// Here's an invalid ULID
ls_Ulid = "71GRGxx4Jr8RECEN4D4VK4F62!"
li_Valid = loo_Dt.UlidValidate(ls_Ulid)
Write-Debug "valid: " + string(li_Valid)


destroy loo_Dt