C#在文本文件中分隔单词
我有一个文本文件,其中有许多单词被C#在文本文件中分隔单词,c#,text-files,C#,Text Files,我有一个文本文件,其中有许多单词被隔开。看起来是这样的: eye;hand;mouth;arms;book three;head;legs;home string g = readText.Replace(";", "\n"); 我想浏览这个文件并搜索符号并修改文件,使每个单词都换位换行符 string g = readText.Replace(";", "\n"); 我应该先用 string path = @"c:\temp\MyTest.txt"; string readText =
隔开代码>。看起来是这样的:
eye;hand;mouth;arms;book
three;head;legs;home
string g = readText.Replace(";", "\n");
我想浏览这个文件并搜索符号编码>并修改文件,使每个单词都换位换行符
string g = readText.Replace(";", "\n");
我应该先用
string path = @"c:\temp\MyTest.txt";
string readText = File.ReadAllText(path);
string g = readText.Replace(";", "\n");
然后检查:
if readText.contains(";");
string g = readText.Replace(";", "\n");
但是我不知道下一步该怎么办你是说这个吗
string g = readText.Replace(";", "\n");
使用
string g = readText.Replace(";", "\n");
使用readText,替换(“;”,Environment.NewLine)