DCOUNT

DCOUNT


DATE Index Level DEBUG
Syntax DCOUNT( string.expression1, string.expression2 )
Category BASIC
Type Function
Description returns the number of occurrences of the delimiter specified in "string.expression2" within "string.expression1", plus one.

The difference between this function and the "count" function is that 1 is added to the result unless the string referenced in "string.expression1" is null.
Options
See Also u201e functions COUNT
Example string = "a" : char(254) : "b" : char(254) : "c"
how.many = dcount(string,char(254))
for amc = 1 to how.many
 crt string<amc>
next amc

"how.many" contains the number of attributes in "string". In this example, there are 3 and each attribute is displayed to the terminal on a separate line.

input sentence
sentence = trim(sentence)
maxwords = dcount(sentence,' ')
for wordcnt = 1 to maxwords
 print field(sentence,' ',wordcnt)
next wordcnt

In this example, "sentence" is entered from the keyboard. The string in "sentence" is trimmed of excess blanks, and the number of words delimited by spaces is counted using "dcount". The words are then printed on separate lines.
Warnings
Compatibility D3 7.0 AP R83
DATE Index Level DEBUG