السلام عليكم
ارجو المساعده عاجلا في كود جافا يستخرج نص عربي ويحذف التعليقات فانا بحاجه للرد بسرعه
هذا الكود يقرا نص
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
package readTextFileExample;
/**
*
* @author ado-mot3b
*/
/**
* @param args the command line arguments
*/
public class ReadTextFileExample {
public static void main(String[] args) {
File file = new File("test.txt");
StringBuffer contents = new StringBuffer();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String text = null;
// repeat until all lines is read
while ((text = reader.readLine()) != null) {
contents.append(text)
.append(System.getProperty(
"line.separator"));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
// show file contents here
System.out.println(contents.toString());
}
}
سؤالي كيف احذف تعليق مابين الاقواس وكيف احذف الهامش اللي في نهاية الصفحه وهو نص في نهاية الصفحه مكتوب بعد line
وشكرا