关键是怎么处理哈
用.net是很容易实现,我想知道用delphi怎么实现
.net的代码是这样的:
DataSet1 ds = new DataSet1();
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
{
using (StreamReader sr = new StreamReader(openFileDialog1.FileName, Encoding.GetEncoding("GB2312"
))
{
string line;
while ((line = sr.ReadLine()) != null)
{
if (!Regex.Match(line, @"[/u4e00-/u9fff]"
.Success)
{
try
{
DataRow dr = ds.Tables[0].NewRow();
dr[0] = line;
ds.Tables[0].Rows.Add(dr);
}
catch { }
}
}
sr.Close();
}
ds.Tables[0].AcceptChanges();
using (StreamWriter sw = new StreamWriter(this.saveFileDialog1.FileName, false, Encoding.GetEncoding("GB2312"
))
{
if (ds.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in ds.Tables[0].Rows)
{ sw.WriteLine(dr[0].ToString()); }
}
sw.Close();
}
MessageBox.Show("完了!"
;
}
}