private void getridofspace()
{
string new_text = null;
OpenFileDialog of = new OpenFileDialog();
of.Filter = "txt文件|*.txt|所有文件|*.*";
of.AddExtension = true;
of.Title = "打开文件";
if (of.ShowDialog() == DialogResult.OK)
{
StreamReader rd = File.OpenText(of.FileName);
string text = rd.ReadToEnd();
string[] temp = text.Split(' ');
for (int i = 0; i < temp.Length; i++)
{
new_text += temp[i];
}
rd.Close();
}
SaveFileDialog sf = new SaveFileDialog();
sf.Filter = "txt文件|*.txt|所有文件|*.*";
sf.AddExtension = true;
sf.Title = "另存为";
if (sf.ShowDialog() == DialogResult.OK)
{
FileStream fs = new FileStream(sf.FileName, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
sw.Write(new_text);
sw.Flush();
sw.Close();
fs.Close();
}
}
public Replace(
oldValue,
newValue
)
public string Replace( string oldValue, string newValue )