C# modify file (read all and modify and write all)
来源:互联网 发布:颂歌java 编辑:程序博客网 时间:2024/05/17 03:07
StringBuilder newFile = new StringBuilder();
string temp = "";
string[] file = File.ReadAllLines(@"C:/Documents and Settings/john.grove/Desktop/1.txt");
foreach (string line in file)
{
if (line.Contains("string"))
{
temp = line.Replace("string", "String");
newFile.Append(temp + "/r/n");
continue;
}
newFile.Append(line + "/r/n");
}
File.WriteAllText(@"C:/Documents and Settings/john.grove/Desktop/1.txt", newFile.ToString());
string temp = "";
string[] file = File.ReadAllLines(@"C:/Documents and Settings/john.grove/Desktop/1.txt");
foreach (string line in file)
{
if (line.Contains("string"))
{
temp = line.Replace("string", "String");
newFile.Append(temp + "/r/n");
continue;
}
newFile.Append(line + "/r/n");
}
File.WriteAllText(@"C:/Documents and Settings/john.grove/Desktop/1.txt", newFile.ToString());
- C# modify file (read all and modify and write all)
- C# Read and Modify XML File
- check then act and read modify write
- file read and write
- Add and modify module
- Read and Write File Code
- read and write '.bmp' file
- Reading and modify OS X plist file by command line
- Print Program and Form Modify
- String replace() and replaceAll() modify
- [zz] Read and write a properties file
- file read and write use java
- Read and Write a /proc File
- Example : Linux kernal file read and write
- read from and write to file
- Ubuntu Read and Write NetCDF file
- python.pandas read and write CSV file
- Create, Read, Write, Copy, Move and Delete a Text File using C# and VB.NET
- 查询记录中几个字段相同的记录
- hide insteadof close form
- QQ登录界面因果图法设计测试用例
- C# 2.0 send email
- pentaho源码分析
- C# modify file (read all and modify and write all)
- 如何用visual studio 2005中调试 Windows Mobile MFC ACTIVEX控件
- JAVA反射机制的认识
- 汉语编程历程 -- 盛传版
- java常用方法集合
- JS+CSS实现的菜单
- [VB/VBA]SQL操作EXCEL
- 实现多服务器session共享之NFS共享
- 网络时代,我们要怎么样做系统