I am trying to make an RPA that searches a list of strings based on the string input by the user. Below is an example of what im trying to do.
Names is a list of strings that i want to search through and return a string if there is a match. Input is from the user that would be “.split()” into a list which its elements would be used to perform the search. All searches are performed with the “.ToLower” function.
Names = {{Sam Tan Da Ming}, {Ng Xiao Xiao, Alex}, {Sam Wong Ah Boi}}
Case 1: Input = “Sam Tan”, returned result should be “Sam Tan Da Ming”
Case 2: Input = “Alex Ng”, returned result should be “Ng Xiao Xiao, Alex”
Case 3: Input = “Sam Chan”, returned result should be “No Match”
Your reply has helped alot! However, after experimenting the line in “Message Box”, i realised that if my input was “Sam”, i would get something like “Sam Tan Da MingSam Wong Ah Boi”. Is there anyway the code can be modified include ", " after every entry? Meaning Input: Sam, Result: Sam Tan Da Ming, Sam Wong Ah Boi.
I made edits after figuring out that adding ", " would be more useful for my use case.
Hi SorenB, initially i used something akin to this but figured that because “Contains” was used instead of “Equals”, inputting “Ng” in an attempt to generate “Ng Xiao Xiao, Alex” would also generate “Sam Wong Ah Boi” and “Sam Tan Da Ming” due to the “Ng” in “Wong” and “Ming”. I would have used this if my requirements were not of a strict search function.
Thanks for your reply tho! I also admit that your code was way cleaner than mine!