I am trying to do a for each loop to find out specifically what value a variable has in an array (read using ocr text)
I know that the line that always comes after it will contain a certain string that i can find using item.tostring.contains in a for each loop, my question is using that, how can i find the value of the string that comes before it in the array?
Welcome to UiPath community!
If you are trying to get previous element before the match is found , you can find the element which you know it is appearing, get its index now by using this index as per your requirement you can access the previous elements.
If this is not what you are looking for, please explain a bit in detail.
So i’m using the ‘read PDF with OCR’ activity and basically getting a large chunk of text seperated by new lines, which i am seperating by environment.newline. Since OCR is quite unreliable, sometimes it will put new lines of gibberish in between, changing the total index numbers and making the string i can find have a different index every time. I can find that index because the contents of that one are static, but the contents of the line I am looking for are not (although it is always before the static line)
Hope that makes sense.