Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Count number of Charter in a string with separator

d4xtian
Participant
0 Kudos

HI, guys

I have a variable that has a value of:

Variable type string value 'A,BC,D,E' .

i want to count the number of entryor character in the variable... to be precise 'BC' is considering as a entry... so here we have 4 entry....

Hope it is clear,

THanks

3 REPLIES 3

FredericGirod
Active Contributor
0 Kudos

you could do it with split and could the number of lines in the table. Or you could do it manually with a Do. Enddo. Testing each character ...

d4xtian
Participant
0 Kudos

I find this solution that it work but seem not right.

FIND ALL OCCURRENCES OF separator
IN Variable
MATCH COUNT count .
" Here is to add the number before the first comma
count = count + 1 .

what do you think ?

Sandra_Rossi
Active Contributor
SPLIT variable AT ',' INTO TABLE DATA(segments).