Comma separated string

atuldalvi

Member
i want to add comma (,) in below string

DEFINE VARIABLE vcSplCharStr AS CHARACTER NO-UNDO INIT '\,/,:,*,?,",<,>,|,&'.

How ?
 
One way is to use a different character as the separator...

Code:
DEFINE VARIABLE vcSplCharStr AS CHARACTER NO-UNDO INIT '\}/}:}*}?}"}<}>}|}&},'.
DEFINE VARIABLE lvi AS INTEGER     NO-UNDO.


DO  lvi = 1 TO NUM-ENTRIES(vcSplCharStr,"}"):
  MESSAGE ENTRY(lvi,vcSplCharStr,"}")
    VIEW-AS ALERT-BOX INFO BUTTONS OK.
END.
 
Chances are you don't really need the separator characters if every entry is just a single character. The virtue of ENTRY is that the entries can be of different size.
 
Use space as separator ( default one used by ENTRY if i m not wrong ). As suggest tamhas, you do not need another one for the list above.
 
ENTRY uses comma as default. And spaces make life hard from experience. Tamhas is saying you don't need any delimiter for the situation above as you can just do substring(n,1) for example to get the nth term.
 
If you do, for some reason, need a delimited string then another option is to use a control character. Lots of people use ^A in these situations.
 
Back
Top