Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Occurances

Status
Not open for further replies.

Smithsc

MIS
Apr 20, 2007
143
GB
Hi,
Is there a formula that can count the number of occurances of a certain charachter in a string. I need to add this into a formula field. I'm using CR XI

Thanks
 
manipulate this formula to meet your needs

numbervar a := len({@text1});
numbervar b;
numbervar counter;
stringvar c := "a"; // character looking for
for b := 1 to a Do
(
if mid({@text1},b,1) = c then counter := counter +1
);
counter


_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top