C# Split方法操作取出文本文档txt文件里数据

文本文档有一行数据或多行数据,其中各列之间是用“~~”号分割的,想取出各列的数据用到split方法

string[] split = strTemp.Split(new string[1] { "~~" }, StringSplitOptions.None);

strTemp 是从文本读取出来的数据

读取文本数据

StreamReader sr = new StreamReader(new FileStream("文本名称", FileMode.Open, FileAccess.Read), System.Text.Encoding.Default);
            string strTemp = sr.ReadLine();
原文地址:https://www.cnblogs.com/junjie94wan/p/2794754.html