string[][] Chop = null;
string[] Line = null;



private void button1_Click(object sender, EventArgs e)
{
    Line = textBox1.Text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None); // Im succesfull at cutting the input per line and stores it per line in Line variable.

    for(int x = 0;x < Line.Length; x++)
    Chop[][x] = Line[x].Split(' ');

//I want the Chop to have an array of array of strings.

最佳答案

因此,您需要行的数组,并且每行都需要一个单词数组:

string[][] lineWords = textBox1.Text
            .Split(new[] { Environment.NewLine }, StringSplitOptions.None)
            .Select(l => l.Split())
            .ToArray();

关于c# - 我只需要减少每行的输入。然后在C#中每个单词空间剪切每一行,但我似乎无法弄清楚2d数组的工作原理,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13204452/

10-16 12:01