Split function or easier way?

Printed From: Crystal Reports Book — Forum Name: Technical Questions

Hi Hive brain,

I have a string field that can be a number of values separated by a comma e.g

CAT, DOG, HORSE
CAT, HORSE
HORSE
HORSE, DOG, HAMSTER
I may also have a Null value here

What I would like to do is count the number of values e.g

CAT, DOG, HORSE = 3
CAT, HORSE = 2
HORSE = 1
HORSE, DOG, HAMSTER = 3
I may also have a Null value here = 0

Thats all I need, I don't really need an array of the values, I just need to know how many values there are. I've started down the "Split" function route but I can't seem to get what I want, is there an easier way?
Easier, I do not think so.  It is a parsing problem.  Usually I set up a loop to 'count' each item in the list.  There may be a better solution.  If I have time, I may look into it.
Create a formula using this code (crystal syntax):

If Isnull({Table.StringField}) Then 0 Else Ubound(split({Table.StringField}, ","))
Seems to work perfectly! Thank you very much!