TALLY
TALLY returns a FIXED BINARY(31,0) result that indicates the number of times that string y appears in string x.
If y does not appear in x, a value of 0 is returned.
- x and y
- String expressions.
Both x and y must have computational type and should be character, bit, graphic, uchar, or widechar type.
If either x or y are the null string, the result is zero.
Example
TALLY ('We''ve got the Power!', 'power'); /* returns 0 */
TALLY ('We''ve got the Power!', 'Power'); /* returns 1 */
TALLY ('We''ve got the Power!', ' '); /* returns 3 */
TALLY ('We''ve got the Power!', 'e'); /* returns 4 */
TALLY ('1001'B, '1'B); /* returns 2 */