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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count character in a string

Status
Not open for further replies.

crystaldev1

Programmer
Nov 6, 2003
232
US
I'm using CR 9. Is there way to count a specific charcter in a string? For ex, I would like to count the number of X's in a string. Thanks.
 
Use a formula like this:

whileprintingrecords;
stringvar x := {Table.string};
numbervar i;
numbervar j := len({table.string});
numbervar y := 0;
for i := 1 to j do(
if ucase(x) = "X" then
y := y + 1
);
y

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top