Character Data Types

ViviFire provides two character data types to deal with Unicode characters used in the processing of text. A Char holds a single character, while a String can hold an indefinite number of characters.

For a side-by-side comparison of ViviFire data types, see Data Type Summary.

Char type

The Char data type represents a single two-byte Unicode (UTF-16) character. If you need a variable to store just one character, declare it like the following:

Dim initial As Char

Each possible value in a Char or String variable is a code point, or character code, in the Unicode character set, in the range &H000–&HFFFF (0–65535 decimal). Unicode characters include the basic ASCII character set (&H0000–&H007F, 0–127 decimal), accented letters, various non-Latin scripts, and signs and symbols.

NoteThe Unicode character set reserves the code points &HD800 through &HDFFF (55296–55551 decimal) for surrogate pairs, which require two 16-bit values to represent a single code point. A Char variable cannot hold a surrogate pair, and a String uses two positions to hold such a pair.

For more information, see Char Data Type.

String type

The String data type represents a sequence of zero or more two-byte Unicode (UTF-16) characters. If you need a variable to store an indefinite number of characters, declare it like the following:

Dim fullName As String

For more information, see String Data Type.

See also