(PowerBuilder) Validate a ULID
Checks to see if a ULID is valid.
Important: Chilkat's ULID functionality was introduced in v9.5.0.94.
integer li_rc
oleobject loo_Dt
string ls_Ulid
integer li_Valid
loo_Dt = create oleobject
// Use "Chilkat_9_5_0.CkDateTime" for versions of Chilkat < 10.0.0
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
|