vb.net - Extract whole row/line using Lumenworks CSV Parser -
how read whole row while using lumenworks cvs parser? far able read entry entry not whole row. i.e. if row a,b,c,d,e,f, able pluck out each individual alphabet. however, want able read whole row
currently have:
my_csv = new csvreader(new streamreader(file_path), false, ",", resetpoint) field_count = my_csv.fieldcount while my_csv.readnextrecord() 'process data here 'this code process each individual alphabet in 1 row the above reads each individual alphabet. want have like
row = my_csv.row
is option available or similar?
'edited'
when have basic vb programming skills me, come solve problem
dim my_string string = "" x integer = 0 my_csv.fieldcount - 1 my_string += my_csv(x).tostring.trim + "," next my_string = mid(my_string, 1, len(my_string) - 1) return my_string by means use code in marked answer. super elegant!
i haven't found available, should work:
vb:
dim rowfields = enumerable.range(0, my_csv.fieldcount). select(function(field) my_csv(cint(my_csv.currentrecordindex), field)) dim line string = string.join(my_csv.delimiter.tostring(), rowfields) c#:
var rowfields = enumerable.range(0, my_csv.fieldcount) .select(field => my_csv[(int)my_csv.currentrecordindex, field]); string line = string.join(my_csv.delimiter.tostring(), rowfields);
Comments
Post a Comment