Easy way to pick elements?

Posted by goo on 20-Apr-2018 04:11

11.7

Having strings like this:

e:\progress\{MedlemsNr}\logg{Klientnr}

where {xxxx} is elements that I need to pick and check, what whould be the easiest way doing that?

I could use do i = 1 to num-entries(stringX,'{'):

  Element = '{' + substring(entry(i,stringX,'{'),1,index(entry(i,stringX,'{'),'}').

but I wonder if there is other ways that could be easier?

//Geir Otto 

All Replies

Posted by goo on 20-Apr-2018 04:21

I would probably used '}' instead to test for elements....

Posted by David Abdala on 20-Apr-2018 05:24

I do:

inNE = NUM-ENTRIES(data,'~{').

DO inInd = 1 TO inNE:

toTest =ENTRY(inInd,data,'~{').

IF NUM-ENTRIES(toTest,'}') LE 1 THEN /* it should never be LT 1.. but..*/

  NEXT.

found = ENTRY(toTest,'}').

END.

Posted by goo on 20-Apr-2018 09:16

😊 that was easier then the one I made, but still more or less the same. I was wondering if there was a .Net way using Array or something like that 😊
 
//Geir Otto
 

Posted by OctavioOlguin on 21-Apr-2018 14:47

I just found I've asked same question here

community.progress.com/.../38133

This thread is closed