1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to parse two characters at a time for one Iteration?

Discussão em 'StackOverflow' iniciado por fdantas, Junho 14, 2019.

  1. fdantas

    fdantas Administrator Moderador

    I have a written query for matching 2 characters and parse the data but I feel that the way i did is wrong. Let me share my logic with you

    DEFINE VARIABLE I AS INTEGER NO-UNDO.
    DEFINE VARIABLE cData AS CHARACTER NO-UNDO.
    DEFINE VARIABLE cParsData AS CHARACTER NO-UNDO.

    ASSIGN
    cData = 'PRRSCLPP0123456789'.

    DO I = 1 TO LENGTH(cData):

    cParsData = SUBSTRING(cData,I).
    IF cParsData MATCHES 'PP*' THEN MESSAGE SUBSTRING(cParsData,4,9).

    END.



    As you see the way i did is wrong and its parsing each character per iteration i think but what i need is it should parse two characters per iteration so that we can matches "PP". You can share or change the logic for different ways to get the same output

    Continue reading...

Compartilhe esta Página