Which substring appears first in string

Hi,

I have a huge string and I need to find out if in this string I have “test:” or “prod:” firstly. I will have both of them but I need to know which one appears firstly.
Thanks for help.

Best Regards,
Logan

@logan.capp - could you please share some sample text. ?

It is kind of confidential but its like this:

" UiPath is a New York City-based global software company that develops a platform for robotic process automation (RPA). The company’s software monitors user activity to automate repetitive front and back office tasks, including those performed using other business software such as [customer relationship management]prod:(Customer relationship management - Wikipedia) or enterprise resource planning (ERP) test: software."

You can use “Your String”.IndexOf(“SearchTerm”). It will get the position of the first occurence of your search term. If there is no match, it will return -1. If both SearchTerms exist in the text, check which has the lowest position.

1 Like

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