Forcing Character
ANSI
Since string literals are enclosed in double quotes ("), a technique must be employed to include the quote sign within a literal. The pound sign (#) has been designated as a Forcing Character for this purpose. The pound sign informs the compiler that the next character is part of the string. The compiler recognizes the Forcing Character and does not include it. If the Forcing Character is required in the string, it must be used twice for each one desired (i.e., "##" to use # in a string literal).
An alternate method for specifying a (") in a string is also provided. By placing two double quotes together in a string literal, the first quote acts as a forcing character for the second quote. The quote is not a universal forcing character, i.e., the only character that may be forced using a quote is a quote.
The Forcing Character rules do not apply in operations where the operand must be a single character only (i.e., CMOVE, CMATCH). Literals used with single character operations may include both the quote sign and the pound sign (i.e., CMATCH "#" TO INPUT).
See Also: Instruction Syntax
![]() |