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 +。 但感謝您指出。