|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Counting number of items in a string - desperately need help!
Originally posted by : Michele (mserafini@spotlighthealth.com)Hi - I am trying to loop through items in a table that are stored like this:Morbid Obesity,Multiple SclerosisMorbid Obesity,Multiple Sclerosis,Arthritis,Breast Cancer,Multiple Sclerosis,Morbid Obesity, Multiple Sclerosis, Heart Failureand I am trying to count the number of items in each record. For some reason everything I am trying is returning an incorrect record set. I am wondering first of all if it is because some records have a few items and end in a comma, where others have the same amount and don't end in a comma - so therefore basing the count on a comma retuns the wrong number of records? If anyone can help me I would appreciate it so much!
|
|
#2
|
|||
|
|||
|
Originally posted by : Sarav (krs_sar@hotmail.com)Hi,First you check the last character is a comma. If you do not have a comma as the last character then, append a comma to it and store in a variable. Then loop through every character in that string and find out number of commas. Finally the number of items are 1 less than the count.regardsSarav.------------Michele at 7/30/2001 1:15:30 PMHi - I am trying to loop through items in a table that are stored like this:Morbid Obesity,Multiple SclerosisMorbid Obesity,Multiple Sclerosis,Arthritis,Breast Cancer,Multiple Sclerosis,Morbid Obesity, Multiple Sclerosis, Heart Failureand I am trying to count the number of items in each record. For some reason everything I am trying is returning an incorrect record set. I am wondering first of all if it is because some records have a few items and end in a comma, where others have the same amount and don't end in a comma - so therefore basing the count on a comma retuns the wrong number of records? If anyone can help me I would appreciate it so much!
|
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > Counting number of items in a string - desperately need help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|