Data rules:
1. The fields in each row are delimited by the ' \x07 ' (invisible character ^g) flag of ASCII code;
2. Each record exists as a separate line in the text file, and the ' \x06 ' (invisible character ^f) flag of the ASCII code is the end of each line;
Demand:
Read the data for each row, and then deposit it into the database.
Because the project needs, so wrote a small program to test the next. The code is as follows:
Package cn.com.syhenian.test;
public class Asciitest {public
static void Main (string[] args) {
String str = "201411030 Red Valley Beach sj11353";
System.out.print (str + ">>");
String newstr = new Asciitest (). ASCII2STR (str);
System.out.print (NEWSTR);
}
Converts the invisible character \x07 to ", \x06 to" "public
String ascii2str (String str) {
string newstr =";
Char[] cs = Str.tochararray ();
int j = 0;
for (int i:cs) {
if (i = = 7) {
Newstr + = ",";
} else if (i==6) {
newstr = "";
} else{
Newstr + + Str.charat (j);
}
j + +;
}
Return Newstr
}
}
The results of the operation are as follows: