VARIANT$$ function  

Purpose

Returns the wide Unicode string contained in a Variant variable.

Syntax

StringVar = VARIANT$$(VrntVar)

Remarks

VARIANT$$ extracts the wide string from a variant variable.  This presumes that the variant contents are a wide Unicode string.  It is generally safe to assume this is the case, unless the variant was created by PowerBASIC and you know the format is not wide Unicode.

You should generally choose VARIANT$$ if the contents are wide Unicode.

Legacy

Older legacy programs were forced to store Unicode characters in an ANSI string variable because wide string variables were not yet available.  These programs should continue to use VARIANT$ until the program logic is updated.  Programs which assign unicode data to a variant from an ANSI string, and retrieve it to an ANSI string must continue to use VARIANT$.

Restrictions

VARIANT$$ presumes that a valid string value is present (VT_BSTR); otherwise, an empty string is returned.

See also

DIM, LET, OBJECT, LET (with Variants), VARIANT#, VARIANT$$, VARIANTVT

Example

DIM vVnt AS VARIANT

vVnt = "Hello World"$$

a$$ = VARIANT$$(vVnt)