Skip to main content
Previous section   Next section

DQUOTE

Encloses a value in double quotation marks.

Synopsis

DQUOTE(string)

Arguments

string An expression that resolves to a string or a numeric. string may be a dynamic array.

Description

The DQUOTE function returns string enclosed in double quotation marks. The quotation marks are part of the resulting string. Therefore, using DQUOTE increases the length of string by 2 characters. If string is the null string (""), DQUOTE 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 DQUOTE function converts a numeric to canonical form before enclosing it in quotation marks. DQUOTE does not convert a numeric string to canonical form.

The QUOTE function is functionally identical to DQUOTE. The SQUOTE function is similar, except that it encloses string with single quotation marks, rather than double quotation marks.

Note:

Some MultiValue Basic implementations (D3, for example) use DQUOTE and SQUOTE to extract quoted substrings from within a string. The Caché MVBasic quote functions do not support this functionality. Use the FIELD function or the [ ] operator to extract quoted substrings.

Examples

The following example uses the DQUOTE function to convert a numeric to a string enclosed in double quotation marks:

quoted = DQUOTE(+007.000)
PRINT quoted;            ! Returns "7"
PRINT LEN(quoted);       ! Returns 3
Copy code to clipboard

The following example uses the DQUOTE 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 = DQUOTE(str1)
q2 = DQUOTE(str2)
q3 = DQUOTE(str3)
PRINT q1:q2:q3;       ! Returns "Hello""Hello""Hello"
PRINT LEN(q1),LEN(q2),LEN(q3);    ! Returns 7    7    7
Copy code to clipboard

Note that the quote marks are not simply string delimiters, but are part of the returned string.

See Also