gpt4 book ai didi

c# - 如何阅读文本框中的最后一行?

转载 作者:太空狗 更新时间:2023-10-29 22:15:51 27 4
gpt4 key购买 nike

我有一个不断更新的多行文本框。我只需要阅读文本框中的最后一个单词/句子。

string lastLine = textBox1.ReadLine.Last();

最佳答案

试试这个:

if (textBox1.Lines.Any())
{
string lastLine = textBox1.Lines[textBox1.Lines.Length - 1];
}

最后一句话:

string lastword = lastLine.Split(' ').Last();

关于c# - 如何阅读文本框中的最后一行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32924410/

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