Check if a list contains an element
The attached process demonstrates two ways of searching a list to check if it contains a specific element.
- The first way uses a loop to check all the elements in the list and an index variable to store the position of the element, if found.
- The second way uses the "Parse Text" with a regular expression to search the given list.
2 people like this idea
It's not working, i have list of 600 elements and and i can't loop through each element because the size of the list may increase. i have used parse text and it's giving me the index of the element more than to size of the list.
I have attached sample data of 60+ record and i want o find the 5 element from last.
parse the filecontents and grab the position directly.
see the screenshot.
1 person likes this
Oh, I forgot to say I'm considering all your references are the same lenght as the example you provided to avoid the iteration.
In a diferent case you will need to iterate the list.
How did you arrive at %PositionFound/13 + 1% for the list the find the position of the word in the list ? Working a similar requirement where ,need to find the position of the word in the list. As the list has more than 300+ elements from an Excel File
Got it the characters including the \r\n which makes it 13 characters in all. The length of the words in the list need to be constant. Thanks