Find specific text in RichTextBox and set it to a string c#

后端 未结 4 1122
一向
一向 2021-01-28 13:56

I am at a loss as to how to do this. I am printing some information to a richtextbox that will be multiple lines, has words and numbers. I need to search the richtextbox for spe

4条回答
  •  盖世英雄少女心
    2021-01-28 14:13

    You can use a Linq query to find the number like below:

    var nums = Enumerable.Range(1,30).Select(x => x.ToString());
    var num = richtextbox1.Text.Split(' ')
                          .Where(x => numStr.Contains(x))
                          .Single();
    Console.WriteLine("The user number is " + num);
    

提交回复
热议问题