string manipulations

Hie dear frenz,

Im a beginner here, I would like your help on how to to string manipulations. I have done aprogram that reads a text lines from a file and write it out to another text file. But, at the same time, I need to display the text file line by line and store it in the string, and manipulate it. he manipulations i emant is like adding some semiclons after soem characters and write out to a new file. I dunt understand how to store the string here adn how to manipulate it from the stored place. Plz help me here. Thanks in advance. Here is the code of the program for ur reference.....may GOD bless you...

mport java.io.*;

import java.util.*;

class ReadData1Test

{

public static void main(String args[]) //main declaration

{

ReadData1Test r = new ReadData1Test();//constructor

r.readmyfile();

}

void readmyfile(){

// String line = null;

// int recCount = 0;

try{

FileReader fr= new FileReader("aliran.txt");// the FileReader is a subclass of InputStreamReader that is useful if you want to read text from a data file.

BufferedReader br = new BufferedReader(fr);//use Bufferreader instead of datainputstream as it is depreciated

PrintWriter pw = new PrintWriter ("newaliran.txt");// to print the contents of read file to a new file

//line = new String();

// while ((line= br.readLine()) != null) {

// recCount++;

//System.out.println(recCount + ": " + line);

String line;

line = br.readLine();

br.close();

pw.close();

pw.println(line);

System.out.println("The first line in the text file is: " + line);//print out the text in the file

}

//

catch (IOException e) {

// catch possible io errors from readLine()

System.out.println("Problem finding file!");

}

}

[1890 byte] By [bikejokeya] at [2007-10-1 19:45:10]
# 1

Piece(s) of advice:

[1] use code tags.

public class Good {

public static void main(String[] args) {

// ...

}

}

is more readable then this:

public class NotGood {

public static void main(String[] args) {

// ...

}

}

[2] leave the GOD business away (unless your programming a recursive mehod of some kind : ) )

[3] For future postings: I think this is more of a topic for the fundamentals-forum instead of the algoritms...

And I don't know what exactly it is you want. Could you give an example of the String manipulation you want to do?

prometheuzza at 2007-7-11 16:06:06 > top of Java-index,Other Topics,Algorithms...