gpt4 book ai didi

c# - 我只需要减少每行的输入。然后在C#中每个单词空间剪切每一行,但我似乎无法弄清楚2d数组的工作原理

转载 作者:太空宇宙 更新时间:2023-11-03 17:55:07 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com