Note that there are some explanatory texts on larger screens.

plurals
  1. POsplitting comma separated dataset into separate arrays
    primarykey
    data
    text
    <p>I have a .csv file I'd like to modify. Here is the format of the file:</p> <pre><code> Id, UTMGridEast, UTMGridNorth, LocDate, LocTime, Species </code></pre> <p>What I have done already is create an arraylist of all these values, but what I would like to do is create an arraylist of all the values and each line in the dataset is another array. This is because I need to edit the fields <code>UTMGridEast</code> and <code>UTMGridNorth</code> and then reinsert them into the arraylist.</p> <p>My GUI consists of just two buttons, here is my code so far:</p> <pre><code>public partial class MainWindow : Window { private string _filename; private string[] _splitValues; public MainWindow() { InitializeComponent(); } private void btnLoad_Click(object sender, RoutedEventArgs e) { // Configure open file dialog box Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = "Dataset"; // Default file name dlg.DefaultExt = ".txt"; // Default file extension dlg.Filter = "Commar Seperated Values (.csv)|*.csv" ; // Filter files by extension // Show open file dialog box Nullable&lt;bool&gt; result = dlg.ShowDialog(); // Process open file dialog box results if (result == true) { // Open document _filename = dlg.FileName; txtFilePath.Text = _filename; } } private void btnConvert_Click(object sender, RoutedEventArgs e) { ConvertToLatLong(); } private void ConvertToLatLong() { string textFile = System.IO.File.ReadAllText(_filename); foreach (var value in textFile) { _splitValues = textFile.Split(','); Console.WriteLine("Split values: " + _splitValues[value]); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload