Package: glib
Function glib:variant-parse
Lambda Listglib:variant-parse (vtype text) Argumentsvtype -- a g:variant-type instance, or a valid type string text -- a string containing a g:variant instance in text form Return ValueThe g:variant instance. Details Parses a g:variant instance from a text representation. If vtype is non-nil then the value will be parsed to have that
type. This may result in additional parse errors, in the case that the parsed
value does not fit the variant type, but may also result in fewer errors, in
the case that the variant type would have been ambiguous, such as with empty
arrays. In the event that the parsing is successful, the resulting g:variant instance is returned. In case of any error, nil will be returned. Officially, the language understood by the parser is any string produced by the g:variant-print function. Examples(g:variant-parse (g:variant-type-new "b") "true") => #.(SB-SYS:INT-SAP #X7F99C4012440) (g:variant-print *) => "true" (g:variant-parse "b" "false") => #.(SB-SYS:INT-SAP #X564C855E8690) (g:variant-print *) => "false" (g:variant-parse (g:variant-type-new "i") "100") => #.(SB-SYS:INT-SAP #X7F99C4012CF0) (g:variant-print * nil) => "100" (g:variant-parse "d" "100") => #.(SB-SYS:INT-SAP #X564C855F9900) (g:variant-print *) => "100.0" | See also |
2024-11-21