(限制:系统;仅限)
我希望能够将一个字符串拆分成一个数组并删除空格,我现在有这个:
string[] split = converText.Split(',').Select(p => p.Trim()).ToArray();
Run Code Online (Sandbox Code Playgroud)
编辑:另外.ToArray显然不能使用.
但问题是,我不能使用其他任何核心系统方法.那么如何在不使用.select或其他非核心方式的情况下修剪分割或数组中的空格.
谢谢!
我希望有一个基于文件中的行的数组,但目前它是一个固定大小的数组:
string[] converList = new string[6]; // Array containing TXT lines
Run Code Online (Sandbox Code Playgroud)
阅读文件:
void ReadConver()
{
string line;
int i = 0;
System.IO.StreamReader file =
new System.IO.StreamReader("C:\\Users\\Kennyist\\Documents\\Visual Studio 2010\\Projects\\soft140as3\\convert.txt");
while ((line = file.ReadLine()) != null)
{
converList[i] = line;
i++;
}
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做?