Character and String Equates

Character equates

A character equate makes the use of non-printable characters more readable. You can use one where you would use a code point, a number specified by a character set.

A character equate is a single token made of two parts. The first character is the percent sign ("%"). The remaining characters are letters ("A" through "Z"). As usual, ViviFire ignores letter case, but this manual always uses capital letters.

A table of all recognized character equates follows.

Code pointCharacter equatesDetails
0 (&H0000)%NUL, %NULLNull
7 (&H0007)%BEL, %BELLAudible bell
8 (&H0008)%BS, %BACKSPCBackspace
9 (&H0009)%HT, %TABHorizontal tab
10 (&H000A)%LF, %LINEFEEDLine feed
11 (&H000B)%VTVertical tab
12 (&H000C)%FF, %FORMFEEDForm feed
13 (&H000D)%CR, %RETURNCarriage return
27 (&H001B)%ESC, %ESCAPEEscape
32 (&H0020)%SPC, %SPACESpace

String equates

String equates permit the use of nonprintable and/or platform-dependent character sequences directly in your code. They can take different forms, as shown below. Each begins with a $ sign.

A decimal (base-10) integer in the range 0–65535.
A binary (base-2) integer in the range 0–1111111111111111.
A hexadecimal (base-16) integer in the range 0–FFFF.
An octal (base-8) integer in the range 0–177777.
An abbreviation for a commonly used string.

Predefined string equates

String equatesDetailsEquivalents
$CR, $RETURNCarriage return$13 $HD $O15 $B1101
$ESC, $ESCAPEEscape$27 $H1B $O33 $B11011
$HT, $TABHorizontal tab$9 $H9 $O11 $B1001
$FF, $FORMFEEDForm feed$12 $HC $O14 $B1100
$LF, $LINEFEEDLine feed$10 $HA $O12 $B1010
$N, $NEWLINENewline(Platform-dependent)

Magic string equates

Certain string equates have values that change depending on factors such as where you place them. The following table summarizes these "magic" string equates.

String equateDetails
$DATEThe date during compilation in UTC
$DATE_DMYThe date in DD-MM-YYYY format
$DATE_MDYThe date in MM-DD-YYYY format
$DATE_YMDThe date in YYYY-MM-DD format
$FILEThe name of the source file
$LINEThe line number within the source file
$OBJThe name of the class, object, trait, or module
$PROCThe name of the procedure
$TIMEThe time during compilation in UTC
$TIME_12The time in 12-hour format ("1:37 PM")
$TIME_12_SECThe time in 12-hour format ("1:37:55 PM")
$TIME_24The time in 24-hour format ("13:37")
$TIME_24_SECThe time in 24-hour format ("13:37:55")