Quantcast
Viewing all articles
Browse latest Browse all 15722

CSV String split, concatenate & join

Noob question, how can I add ' character or concatenate ' character before and after each item in row before String join?

Please see below the current code used and outputs.

Code:

   
Dim Rows = (From line In IO.File.ReadAllLines(FileTest.csv)
                    Where line.Length > 0
                    Let Items = line.Split(","c)
                    Select Items Skip 1).ToList

For Each row In Rows
 
ListBox1.Items.Add(String.Join("'", row))

Next

CSV File:
fName,dDate
x1,09/17/2020
x2,09/16/2020
x3,09/15/2020

Current output on ListBox1:
x1,09/17/2020
x2,09/16/2020
x3,09/15/2020

Needed output on ListBox1:
'x1','09/17/2020'
'x2','09/16/2020'
'x3','09/15/2020'

Thanks!

Viewing all articles
Browse latest Browse all 15722

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>