Search for a specific string in a file - most performant solution wanted

I have file where 1 of 1000 lines, the schema is like “12345,ADM”.

Now let’s say I want to search if “54321,DMA” is in that list. If so return true.

Now I could use the Read TXT activity and afterwards a For Each activity. But that not performant I would say.

The other idea was to use the Read CSV activity and setting the delimiter to something other then a comma. But I don’t think that it’s way faster.

What would be a better way. Maybe writing some lines with Invoke Code activity?

Hi we can try with IsMatch method
Like this
Suppose if the string is stored in a variable named str_input then use a IF condition like this

System.Text.RegularExpressions.Regex.IsMatch(str_input.ToString,”54321,DMA”)

If true it will go to THEN part or to ELSE

Or even with a normal Contains method of string like this
Stringvariable.ToString.Contains(“yourstring”)

cheers @kwoxer

1 Like

Hi @kwoxer

1.use Read Text File Activity create output variable.
2.Next use IF Activity pass the condition like out_var.contains(“your string”).

Regards.
Kommi Jeevan.

1 Like

That’s an easy solution and does not need a Regex. But thank both of you.

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