0
我需要读取大量文件并将数据插入到Ms sql中。 得到一个文件,它看起来文本被分隔// t。 拆分不会做的工作,我甚至用“// S +”尝试,你可以在代码中看到以下split(// s +)不删除空格
public void InsetIntoCustomers(final File _file, final Connection _conn)
{
conn = _conn;
try
{
FileInputStream fs = new FileInputStream(_file);
DataInputStream in = new DataInputStream(fs);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
//String strline contains readline() from BufferedReader
String strline;
while((strline = br.readLine()) != null)
{
if(!strline.contains("#"))
{
String[] test = strline.split("//s+");
if((tempid = sNet.chkSharednet(_conn, test[0])) != 0)
{
// do something
}
}
}
// close BufferedReader
br.close();
}
我需要知道在我的String []的数据被放置在一个文件中与500k线。但是我的测试[]得到长度为1,并且来自readline的所有数据都在0处。
我是否使用分割错误? 还是有其他地方我需要看?:
//米尔
哈哈 - 太谢谢你了 - 为什么地狱didnt我看到了我自己。 是的。 iam在所有其他文件中使用\ s +。 但感谢您指出。