Searching for a substring in a Map
Posted on 2003-11-10
I have a list of 3000 items.
Each item has key and value.
I need to find all the occurrence in the list whose value matches a substring.
My input is "home" and my list is:
001 home gardening
002 stay at home
003 office supplies
004 working from home - guide
005 the homeland office
The output should return the following items:
001, 002, 004 and 005.
I can use a vector and using a loop, perform a string.indexOf validation for each item in the list. Is there a more efficient way of doing this.