2

很抱歉,我是 C# 新手,需要学习很多东西

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

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

4

3 回答 3

1

如果您确实在使用 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;
于 2012-05-26T14:10:35.467 回答
0

假设您的 RichTextBox 的名称是 RichTextBox1;然后以下设置文本框中的值(您应该将其写入文件后面的代码;如果您的表单命名为 Form1,那么您应该将其写入 Form1.cs):

string s = RichTextBox1.Text;
于 2012-05-26T14:09:55.600 回答
0

要在里面选择引用的文本,RichTextBox1你需要这样的东西:

string s = RichTextBox1.Text;
int f = s.IndexOf('"'), l = s.LastIndexOf('"');
if(f != l)
{
  RichTextBox1.Select(s, l - s + 1);
}
于 2012-05-26T14:13:07.753 回答