COUNT

  

DEVELOPER

 

 

Purpose

COUNT counts the number of sub-strings separated by a specific delimiter in a given string.
 

Syntax

variable = COUNT (operand1,operand2)
 

Operation

operand1 is any valid alphanumeric string
operand2
 is any valid alphanumeric literal or variable specifying the delimiter to be used

variable
is any numeric variable
 

Remarks

The delimiter specified in operand 2 can more than one character.
 

Example
 

#A = COUNT("HELLO,WORLD",",").......................gives #A = 2

#A = COUNT("HELLO,WORLD","Z")......................gives #A = 0

#A = COUNT(",",",")........................................gives #A = 2

#A = COUNT("ROGER, ANDY AND FRANK"," ,").....gives #A = 5

#A = COUNT("ROGER, ANDY AND FRANK",",")......gives #A = 2
 

 

COUNT will never return the value 1 since if operand 1 contains only a single delimiter this will be seen as <Null String> <Delimiter> <Null String> i.e. 2 subfields.

 

Comment on this topic

Topic ID: 520036