Read in a txt file separating and storing variables (String , Double and int) for later use
<p>Beginner java programmer , 
I am Looking for a way to read in a txt file (output from a till) while manipulating certain data that relates to the shift type, transaction type and cost to give me my desired result.</p>

<p>Any help would be greatly appreciated.</p>

<p>Example line in txt document:</p>

<p>"<strong>CARD</strong>","<strong>05-07-2012</strong> 10:32:42","Laminate A4",10,<strong>10</strong>,"<strong>NIGHTSHIFT</strong>",1486510814,False,130</p>

<p>So the relevant information I need is in <strong>bold</strong> the rest of the information in the text line is irrelevant.</p>

<p>Where I need to find the total <strong>cost</strong> of all <strong>card</strong> transactions made <strong>yesterday</strong> (05-07-2012) on <strong>Nightshift</strong>.</p>

<p>Heres where I have gotten so far, I have tried to split at night shift. Also thought about using an array as well and storing each value to its own variable but found this too difficult.</p>

<pre><code>import java.io.File;
import java.io.FileNotFoundException;
import java.text.SimpleDateFormat;
import java.util.*;
public class Finder{

public static void main (String args[]) throws FileNotFoundException
{
  Calendar today = Calendar.getInstance();
  SimpleDateFormat formatter= 
  new SimpleDateFormat("dd-MM-yyyy");
  today.add(Calendar.DATE, -1);
  String yesterday = formatter.format(today.getTime());
Scanner sc = new Scanner(new File("textdocument.log"));
while(sc.hasNextLine()) {
String[] numstrs = sc.nextLine().split(yesterday + "\"NIGHTSHIFT\""); // split by "

for(int i = 0; i &lt; numstrs.length; i++)
{
    System.out.println(numstrs[i]);
    System.out.println();

}
}
}
}
</code></pre>

<p>DESIRED OUTPUT:</p>

<p>Nightshift Totals On 05-07-2012</p>

<p>Cash total $20</p>

<p>Card total $40</p>

<p>Eftpos total $20</p>

<p>I hope I have asked clearly.</p>

<p>Thanks</p>
