So I'm parsing a CSV and trying to create a new object from each record. Using BufferedReader != null runs thru the file just fine. Now I use string.split method to put each line into an array. Ideas on how to use the values in the array to create the recordRowObject from the array? I'd post code but I'm on the road mulling this over in my head.
crownedzero 0 Newbie Poster
Recommended Answers
Jump to PostDo you want to keep all as string or else? If they are all string, then in your constructor would be...
String[] rowData; public recordRowObject(String[] data) { if (data==null) { throw new IllegalArgumentException("\nData cannot be null!"); } rowData = new String[data.length]; foreach(String s : data) { rowData[i] …
Jump to PostIt will all depend on how you want your data structure to keep the data and how you are going to use it... You could make it as simple as the first example I gave (copy the string to the class data), but then I don't know how you use …
Jump to PostI'm not going to read all the code above, but this snippet did catch my eye:
…String[] rowData; public recordRowObject(String[] data) { if (data==null) { throw new IllegalArgumentException("\nData cannot be null!"); } rowData = new String[data.length]; foreach(String s : data) { rowData[i] = s; } }
All 10 Replies
NormR1 563 Posting Sage Team Colleague
crownedzero 0 Newbie Poster
Taywin 312 Posting Virtuoso
crownedzero 0 Newbie Poster
Taywin 312 Posting Virtuoso
crownedzero 0 Newbie Poster
crownedzero 0 Newbie Poster
Taywin 312 Posting Virtuoso
stultuske 1,116 Posting Maven Featured Poster
Taywin 312 Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.