Caché MultiValue Basic Reference
QUOTE
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Encloses a value in double quotation marks.
Synopsis
QUOTE(string)
Arguments
string An expression that resolves to a string or a number. string may be a dynamic array.
Description
The QUOTE function returns string enclosed in double quotation marks. The quotation marks are part of the resulting string. Therefore, using QUOTE increases the length of string by 2 characters. If string is the null string ("") QUOTE returns a string consisting of two quotation mark characters, a string with a length of 2. This should not be confused with the null string (""), which has a length of 0.
The QUOTE function converts a numeric to canonical form before enclosing it in quotation marks. QUOTE does not convert a numeric string to canonical form.
The DQUOTE function is functionally identical to QUOTE. The SQUOTE function is similar, except that it encloses string with single quotation marks, rather than double quotation marks.
Examples
The following example uses the QUOTE function to convert a numeric to a string enclosed in double quotation marks:
quoted = QUOTE(+007.000)
PRINT quoted;            ! Returns "7"
PRINT LEN(quoted);       ! Returns 3
The following example uses the QUOTE function to enclose a string in double quotation marks:
str1 = "Hello"
str2 = 'Hello'
str3 = \Hello\
PRINT str1:str2:str3;  ! Returns HelloHelloHello
PRINT LEN(str1),LEN(str2),LEN(str3);  ! Returns 5   5   5
q1 = QUOTE(str1)
q2 = QUOTE(str2)
q3 = QUOTE(str3)
PRINT q1:q2:q3;       ! Returns "Hello""Hello""Hello"
PRINT LEN(q1),LEN(q2),LEN(q3);    ! Returns 7    7    7
Note that the quote marks are not simply string delimiters, but are part of the returned string.
See Also