Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section

DCOUNT

Returns the number of delimited substrings in a string.

Synopsis

DCOUNT(string,delimiter)

Arguments

string The string to search for instances of delimiter. An expression that resolves to a string.
delimiter One or more characters used as a delimiter in string. An expression that resolves to a string.

Description

The DCOUNT function returns the number of delimited substrings that appears in string.

String matching is case-sensitive. Numbers are converted to canonical form, with leading and trailing zeroes and plus signs removed. Numeric strings are not converted to canonical form.

If delimiter doesn't appear in string, DCOUNT returns 1. If delimiter is the null string, DCOUNT returns the number of characters in the string, plus 1.

If string is an empty string ("") DCOUNT returns a count of 0.

Examples

The following example uses the DCOUNT function to return the number of Value Mark delimited substrings in a dynamic array:

colors="Red":@VM:"Green":@VM:"Blue":@VM:"Yellow"
PRINT DCOUNT(colors,CHAR(253));  ! Returns 4
Copy code to clipboard

See Also