Hello,
I am looping through an array of strings. If the item contains a specific text, I need to add the item to a new array. How would I do this? Any help is appreciated.
Thanks in advance!
Hello,
I am looping through an array of strings. If the item contains a specific text, I need to add the item to a new array. How would I do this? Any help is appreciated.
Thanks in advance!
U can do the following way
Initislse a list list_1= New List (Of String)
Inside it use an if Condition with condition as
item.Contains(specific text),
If it is true
Then use add to collections activitiy for adding item to list_1
After adding required items to collections
At the exit, use
list_1.ToArray to convert list to array
As u can’t add items to array so add items to list and convert list to array, this is the overall logic applied here.
Hope it helps you
Regards
Nived N
Happy Automation
Yes buddy
You can create a variable of type list of strings
and within the loop after the condition just use add to collection activity to add that item to the list
Another possible solution is to use Linq:
newArray = oldArray.Where(Function(x) x.Contains("batman")).ToArray
Hi @NIVED_NAMBIAR,
Thank you, your solution works great. The only issue I now face is the timing, as I am filtering through 74,000+ items. Thanks for your help!
Thank you everyone for your time and your responses!
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.