我有一个文本文件,其中包含许多单词;.它看起来像这样:
eye;hand;mouth;arms;book
three;head;legs;home
Run Code Online (Sandbox Code Playgroud)
我想通过这个文件并搜索符号;并修改文件,以便每个单词都换行换行符.
我应该先用字符串读取文本文件,
string path = @"c:\temp\MyTest.txt";
string readText = File.ReadAllText(path);
Run Code Online (Sandbox Code Playgroud)
然后检查:
if readText.contains(";");
Run Code Online (Sandbox Code Playgroud)
但我不知道接下来该做什么
string readText = File.ReadAllText(path);
var result = readText.Replace(";", Environment.NewLine);
Run Code Online (Sandbox Code Playgroud)