unicodeToString

unicodeToString(): String;

The unicodeToString method of the Binary primitive type interprets the binary as Unicode characters and returns a copy converted to a string.

The code fragment in the following example shows the use of the unicodeToString method.

if fileIsUnicode then
    binLen := bin[start : lenLen].unicodeToString.Integer;
else
    binLen := bin[start : lenLen].ansiToString.Integer;
endif;

When invoked from a Unicode application, a Unicode string is returned. When invoked from an ANSI application, the copy is converted from Unicode to ANSI, and an ANSI string is returned.

When converting from Unicode to ANSI, conversion stops at the first null character. If the binary contains embedded nulls, the string returned from the Unicode to ANSI conversion therefore represents only that part of the binary up to the first null character.