Note that there are some explanatory texts on larger screens.

plurals
  1. POParse column in CSV file
    primarykey
    data
    text
    <p>I have several columns of data in a csv file. I was able to isolate the column I want, but now I need to delete "|" and "&amp;" symbols contained in the column. Can anyone help me out? The relevant code is as follows: </p> <pre><code>// CSVRead.java //Reads a Comma Separated Value file and prints its contents. import java.io.*; import java.util.Arrays; import java.util.ArrayList; import java.util.List; import java.util.regex.*; public class CSVRead{ public static void main(String[] arg) throws Exception { BufferedReader b1 = new BufferedReader(new FileReader("Reactions.csv")); BufferedWriter b2 = new BufferedWriter(new FileWriter("Write1.txt")); BufferedWriter b3 = new BufferedWriter(new FileWriter("Write2.txt")); Pattern p1 = Pattern.compile("[+]"); Pattern p3 = Pattern.compile("\t"); Pattern p2 = Pattern.compile("&lt;=&gt;"); Pattern p4 = Pattern.compile(" "); Pattern p5 = Pattern.compile("RSP_[0-9][0-9][0-9][0-9]"); ArrayList&lt;String&gt; reactions = new ArrayList&lt;String&gt;();//List to hold all reactions ArrayList&lt;String&gt; reactionID = new ArrayList&lt;String&gt;();//List to hold all reactions ArrayList&lt;String&gt; genes = new ArrayList&lt;String&gt;();//List to hold all genes String strRead; String strWrite; while ((strRead=b1.readLine())!=null) { String splitarray[] = strRead.split("\t"); String firstentry = splitarray[0]; String secondentry = splitarray[7]; b3.write(secondentry); b3.newLine(); } b2.close(); b3.close(); } //main() } // CSVRead </code></pre> <p>I think I might have to use the expression:</p> <pre><code>genes.add(splitarray[7].replace("|","")); </code></pre> <p>for example. But I'm not sure where to put it or if it's correct. Thanks for you help,</p> <p>Kbball</p>
    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.
 

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