Data Transformation Engine Functions and Expressions Reference Guide

Chapter 3 - Function Reference COUNTSTRING
Functions and Expressions Reference Guide
79
COUNTSTRING
The COUNTSTRING function returns an integer representing the number of times
that a specified character string appears in another character string. The function
begins to look for the character string from the first position of the first string, and
proceeds forward one byte at a time.
Syntax
COUNTSTRING (single-text-expression , single-text-expression)
Meaning
COUNTSTRING (text_to_search , text_to_find_and_count)
Returns
This function returns a single-integer.
The result is a number representing the number of times
text_to_find_and_count appears within text_to_search. If either
text_to_search or text_to_find_and_count evaluates to NONE,
COUNTSTRING
returns 0.
Examples
COUNTSTRING ( "banana" , "a" )
In this example, the function returns a value of 3.
COUNTSTRING ( "aaaa" , "aa" )
In this example, the COUNTSTRING function returns a value of 3.
Uses
Use
COUNTSTRING when you need to know the number of times a specific text
string appears within another text string.
Related Functions
FIND, LEFT, MID, RIGHT