在java定义的文件中怎样,把从文件中拿出的字符串,进行比较呢?怎么很好的处里那个字符串呢?
展开全部
File file = new File ("文件地址");
FileInputStream fis = null;
InputStreamReader isr = null;
BufferedReader br =null;
String line = null;
try {
fis = new FileInputStream(file);
isr = new InputStreamReader(fis);
br = new BufferedReader(isr);
while((line = br.readLine())!= null){
line.trim().equals("需要比较的内容");
FileInputStream fis = null;
InputStreamReader isr = null;
BufferedReader br =null;
String line = null;
try {
fis = new FileInputStream(file);
isr = new InputStreamReader(fis);
br = new BufferedReader(isr);
while((line = br.readLine())!= null){
line.trim().equals("需要比较的内容");
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询