Berserk Docs
Scalar FunctionsType Functions

asguid

Reads a value as a guid when it is one, and returns null otherwise.

A guid is stored as text, so a string (or dynamic string) spelled xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or as 32 hex digits, in any case, is the guid it names; any other value is null. It never converts: use toguid to read other spellings.

Syntax

asguid(value)

Parameters

Prop

Type

Returns: guid

Examples

Example 1 — Any case of the hyphenated spelling

print asguid("74BE27DE-1E4E-49D9-B579-FE0B331D3642")
print_0 (guid)
74be27de-1e4e-49d9-b579-fe0b331d3642

Example 2 — 32 hex digits

print asguid("74be27de1e4e49d9b579fe0b331d3642")
print_0 (guid)
74be27de-1e4e-49d9-b579-fe0b331d3642

Example 3 — Any other spelling is null

print asguid("{74be27de-1e4e-49d9-b579-fe0b331d3642}")
print_0 (guid)
null

On this page