DCOUNT Function

Counts the number of elements in a string that are separated by a specified delimiter.

Syntax

DCOUNT(string, delimiter)

Syntax Elements

string An expression that evaluates to the string to be searched.

delimiter An expression that evaluates to a single character that separates the string elements. If delimiter contains more than one character, only the first is used.

Note

This behaviour can be changed with the DCOUNT compatibility option.

Operation

DCOUNT returns the number of elements in the string that are separated by the delimiter.

DCOUNT can be used to count the number of elements in a dynamic array.

If the delimiter is not contained in the string, a value of 1 is returned.

If the string is null, a value of 0 is returned.

If either string or delimiter is a literal, it must be enclosed in quotes.

Case Insensitivity

If data case insensitive mode is selected (see Case Sensitivity), case is ignored when searching string for delimiter.

Examples

A = "123":@AM:"456":@AM:"789"
B = DCOUNT(A,@AM)

Assigns a value of 3 to variable B, because there are three elements separated by attribute marks in string A.

X = ""
M = DCOUNT(X,"/")

Assigns a value of 0 to variable M, because X is a null string.

A = "THIS.IS.A.TEST"
B = DCOUNT(A,":")

Assigns a value of 1 to variable B, because string A does not contain the specified delimiter.