DCOUNT()

DCOUNT()

Top  Previous  Next

 

The DCOUNT() function counts delimited substrings within a string.

 

 

Format

 

DCOUNT(string, delimiter)

 

where

 

stringevaluates to the string in which delimited substrings are to be counted.

 

delimiterevaluates to the substring separating items in string.

 

 

The DCOUNT() function counts substrings delimited by delimiter within string.

 

If string is null, DCOUNT() returns zero. In all other cases, DCOUNT() returns a value one greater than the COUNT() function applied to the same string.

 

If substring is null, DCOUNT() returns the length of string.

 

Programs compiled with the $NOCASE.STRINGS compiler directive use case insensitive string comparisons in the DCOUNT() function.

 

 

Examples

 

S = "172-34-876"

N = DCOUNT(S, "-")

 

sets N to 3.

 

 

S = 'ABABABABABABA'

N = DCOUNT(S, "BAB")

 

sets N to 4.

 

 

FIELDS = DCOUNT(REC, @FM)

 

This statement counts the fields in REC.

 

 

See also:

COUNT()