package com.test;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class TextConvertor {
public static String convertingStr(String lineStr) {
String retVal = "";
return retVal;
}
public static String readPath = "C:\\Documents and Settings\\Administrator\\桌面http://www.cnblogs.com/coconut_zhang/admin/file://1.txt/";
public static String writePath = "C:\\Documents and Settings\\Administrator\\桌面http://www.cnblogs.com/coconut_zhang/admin/file://1-bak.txt/";
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
File file = new File(readPath);
if (!file.exists()) {
System.out.println("File not exist!");
System.exit(0);
}
BufferedReader br = new BufferedReader(new FileReader(readPath));
BufferedWriter bw = new BufferedWriter(new FileWriter(writePath));
String temp = "";
while ((temp = br.readLine()) != null) {
System.out.println(temp);
int i = 0;
for (i = 0; i < temp.length(); i++) {
String subTemp = temp.substring(i, i + 1);
if (subTemp.matches("[^\\x00-\\xff]")) {
System.out.println(subTemp + ": true");
break;
} else
System.out.println(subTemp + ": false");
}
if(i == temp.length())
temp = temp.substring(0, i - 1) + "\t" + temp.substring(i);
else
temp += "\t ";
bw.write(temp);
bw.newLine();
}
bw.flush();
br.close();
bw.close();
}
}
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
public class TextConvertor {
public static String convertingStr(String lineStr) {
String retVal = "";
return retVal;
}
public static String readPath = "C:\\Documents and Settings\\Administrator\\桌面http://www.cnblogs.com/coconut_zhang/admin/file://1.txt/";
public static String writePath = "C:\\Documents and Settings\\Administrator\\桌面http://www.cnblogs.com/coconut_zhang/admin/file://1-bak.txt/";
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
File file = new File(readPath);
if (!file.exists()) {
System.out.println("File not exist!");
System.exit(0);
}
BufferedReader br = new BufferedReader(new FileReader(readPath));
BufferedWriter bw = new BufferedWriter(new FileWriter(writePath));
String temp = "";
while ((temp = br.readLine()) != null) {
System.out.println(temp);
int i = 0;
for (i = 0; i < temp.length(); i++) {
String subTemp = temp.substring(i, i + 1);
if (subTemp.matches("[^\\x00-\\xff]")) {
System.out.println(subTemp + ": true");
break;
} else
System.out.println(subTemp + ": false");
}
if(i == temp.length())
temp = temp.substring(0, i - 1) + "\t" + temp.substring(i);
else
temp += "\t ";
bw.write(temp);
bw.newLine();
}
bw.flush();
br.close();
bw.close();
}
}