StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.
prince davies wrote:
when we use scanner for splitting comma seperated values in csv file, it returns me only one element in the list. Why does it return only one string by appendeding all values in the file ?
If we print out the count, it does print list.size() =1. If the files has 100 values, it should return 100 as size. Am i not understanding clearly?
prince davies wrote:
If I use this method, it will add each element in csv file into my list. Now the list will hava all 100 values.
prince davies wrote:attached the csv document. Since forum does not allow me to attach csv or xls ; please copy these values into csv file and run it. I need to take each value from this csv file and search in all files in directory to find if it does exist in file.
prince davies wrote:if thare 100 values in csv and 1000 files in a folder, i need to take each value from csv file and loop through all files in that directory. that means thre will be 100*1000 times.
How is your method fuctioning for search a value in all files? When i DEBUG your method, it concatenate all values into string and see if that concateneated value exists in each file in that directory.Thats not my requirement. The value return from your method is a list and it contains a string like this "PCONCO100PCONN25 PCORPDMP PCPT1 PCPT2 PCPT3 PCPT4 PCPT5 PCPT6" and then search this value in each file in a folder.It does not seem to be correct. My requirement is take first value eg:-PCONCO100 and search it in all flies in a folder. then take next one PCONN25 and search it in each file located in that folder..so on and on.... I hope you understand my requirement.
Do you understand why my method returns one big string?
Thanks a lot Tim.. i sincerely appreciate your help....thank you thank you......