Hi,
I need to read the contents of a text file which contains comma separated values into my code. Code iterates until last line in text file is read, then ends. Now i am able to read a line with "strLine". See my code below so far:
TEXT FILE CONTENT (test.txt)
00000000, 05007
00000001, 05487
00000002, 05456
import java.io.*;
public class ODBmain
{
public static void ODBmain()
{
// initialise instance variables
{
try{
// Open the file that is the first
// command line parameter
FileInputStream fstream = new FileInputStream("test.txt");
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
FileWriter fileWriter = new FileWriter("test.xml");
BufferedWriter buffWriter = new BufferedWriter(fileWriter);
while ((strLine = br.readLine()) != null) {
buffWriter.write("<sn:SuMSubscriberProfile id=\"233" + strLine + "\">");
buffWriter.newLine();
buffWriter.write("<kk>05007</kk>");
buffWriter.newLine();
How do i separate strLine so i can read and iterate second field 05007, 05487 in kk.
Thanks