c# - 选择文本框中用双引号写的文本.. windows 窗体应用程序

标签 c# winforms

很抱歉,我是 C# 的新手,需要学习很多 :( 你能告诉我如何在 richtextbox 中选择用引号写的文本来帮助我吗? 就像我在调试程序时写在 richtextbox 中一样

        cout<<"HELLO WORLD"; 
        HELLO WORLD= new array

, HELLO WORLD 应该存储到一个新的数组/字符串中

最佳答案

如果您确实在使用 C#(而不是 C++,我认为您是),您可以执行以下操作:

  string  input = TextBox1.Text; //<--- replace Textbox1 with whatever you called your textbox
  string[] txtWithNoQuotes = input.Split('"');
  string noQuotes = txtWithNoQuotes[1]; // <-- this will give you Hello world, without the quotes

编辑:我觉得我的问题有点不对,如果你只想要某人在文本框中输入的文本,只需这样做

string input  = NameOfYourTextbox.Text;

关于c# - 选择文本框中用双引号写的文本.. windows 窗体应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10766909/

相关文章:

c# - 从 TaskManager 隐藏 Windows 应用程序进程

c# - 将 TabControl 附加到 MDI 父窗体而不是工具条

c# - 处理Winforms中的所有线程异常

c# - Antlr 生成的类对内部的访问修饰符

c# - .NET Multiline TextBox - 设置行数

c# - .NET Core 2.2 HttpClient/WebClient vs Curl - .NET 库对于某些服务器来说非常慢

c# - 静态构造方法与构造函数

c# - VS2010 设计器 Z 顺序

c# - 访问项目的版本信息

c# - Show()、ShowDialog() 和 Application.Run() 函数之间有什么区别?