> hi,
>
> i have a .csv file which i would like to search based
> on certain columns at runtime ?
> what is a good way to do it ?
read the file using File I/O
compare the data you read to your search criteria
> 1. Not sure to use Array or Map ?
depends, array will store a bunch of stuff and a Map will store that stuff in key/value pairs for easy lookup
> 2. how do i implement multiple string keys searches
i use java
What about this solution? For parsing .csv files you can use http://ostermiller.org/utils/CSV.html. The result of the parsing is a 2 dim array. From the example:
String[][] values = CSVParser.parse(
new StringReader(
"hello,world\n" +
"how,are,you"
)
);
Now you can search through the array by hand or use another open source software: http://jakarta.apache.org/commons/jxpath/. With JXPath you can use XPath queries on arbitrary sources (xml files, beans, maps). But I think this is a little bit weird for this example :-)
Christian Ullenboom | tutego