Consultor Eletrônico



Kbase 18095: Code example to parse character string with space delimiter
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   7/10/1998
Code example to parse character string with space delimiter

The code below gives an example of how to process elements of a
character variable or database field that are separated by a space
rather than a comma.

In other words, given a variable with "Red Green Blue" together, the
goal is to process each of "Red", "Green", and "Blue" separately.

DEF VAR x AS CHAR INIT "Red Green Blue".
DEF VAR i AS INT.

DO i = 1 TO NUM-ENTRIES(x, " "):
MESSAGE ENTRY(i,x," ") VIEW-AS ALERT-BOX.
END.


Consult the Language Reference for more information on the NUM-ENTRIES
and ENTRY functions.