Find index of first element of string array containing certain terms

Hi, I have a String array resulting from a Read PDF Text activity which I split by line breaks. I want to get the index of the first element in the array containing certain terms within the string. How do I do this?

@DEATHFISH

Try the below query. Replace array_input with your array variable name and string_to_check with your terms

(from x in array_input where x.Contains("string_to_check") select array.IndexOf(array_input ,x)).FirstOrDefault.tostring
2 Likes

How does the query work? I’ve never seen such syntax in VB.NET

Query checks every item in the array and selects the index of the element which matches the condition.

Try the query, it will work :slight_smile:

@DEATHFISH

Have you tried the query, let me know if it doesnt work.

Thanks it worked!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.