How to extract strings separated by delimiters in progress openedge 4gl?

Discussão em 'StackOverflow' iniciado por fdantas, Março 28, 2016.

  1. fdantas

    fdantas Administrator Moderador

    I have a string v-edistring = "STS++56+202:::DUE TO HOLIDAY1'STS++56+202:::DUE TO HOLIDAY2'STS++56+202:::DUE TO HOLIDAY3'" apostrophe ' denotes termination of lines , each line is a segment . I have extracted each segment and assigned it to variable segment . Now for each segment I need to loop to find the elements ( STS , 56 , 202 , DUE TO HOLIDAY1 ) etc in sequence.

    DEFINE VARIABLE v-edistring AS CHARACTER NO-UNDO. DEFINE VARIABLE v-cnt AS INTEGER NO-UNDO. DEFINE VARIABLE segment AS CHARACTER NO-UNDO.

    v-edistring = "STS++56+202:::DUE TO HOLIDAY1'STS++56+202:::DUE TO HOLIDAY2'STS++56+202:::DUE TO HOLIDAY3'".

    DO v-cnt = 1 TO num-entries(v-edistring, "'") - 1 :

    ASSIGN segment = string(entry(v-cnt, v-edistring, "'")).

    MESSAGE segment
    VIEW-AS ALERT-BOX INFO BUTTONS OK.

    /* FOR EACH segment */
    /*DO:

    alert STS then alert 56 then 202 then due to holiday ( ie loop for elements )

    END. */
    END.

    Continue reading...

Compartilhe esta Página