I'm trying to print the text within the quotes in a file. May I have anyone to help me.
E.g : "Jayaramachandiran"
This line is in a text file,and I wanna read it and print it.
I'm trying to print the text within the quotes in a file. May I have anyone to help me.
E.g : "Jayaramachandiran"
This line is in a text file,and I wanna read it and print it.
Why don't you check out this link:
How do I create a Java string from the contents of a file?
It seems someone has answered your question already. :) The first answer to that question is your best bet.
P.S After reading the file into a string, just go ahead and output the string and voila!
You may use a BufferedReader to read.
See this example:
import java.io.*;
class YourClass {
public static void main (String[] args) throws IOException {
BufferedReader fr = new BufferedReader(new FileReader("yourfile.txt"));
String text = fr.readLine();
fr.close();
System.out.println(text);
}
}
You want to print a string from file, but removing characters, like the quotes, from it. I think it's better first to read the string from file, then remove the quotes.
Check this page.