VariantStringLength

See Also: String, Variant command, Length, SizeOfString, SizeOfWString

Purpose

Returns the number of characters in a variant.

Return Type

Integer

Syntax

VariantStringLength(variantString)

What it Does

VariantStringLength returns the size of the variant string in UTF-16 code units. This message is only useful for working with (some) web services.

Example

A Variant BSTR is how the Variant datatype handles and stores strings. The actual format it uses is not relevant to this discussion, although it might be of use to recognize that they are multi-byte character strings (i.e., UNICODE). When we store strings in a variant, they are converted to BSTR, meaning they are converted from OEM to UNICODE. When we convert a variant BSTR to a string, it is converted from UNICODE to OEM.