在richtextbox中剪切一个特定的文本 [英] cut a spacific text in richtextbox

查看:82
本文介绍了在richtextbox中剪切一个特定的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我是编程方面的新手,所以任何人都可以帮助我如何从RichTextBox中删除特定的文本长度,就像下面的示例一样,

Hi,
i''m some kind new in programming, so Can any one help me on how we can remove a specific text length from a richtextbox, just like the example below,

SUV          4402577816         ABC        00:00:00 109.127.100.33
SUV          6651215553         ABC        00:00:00 109.127.104.75
SUV          6651231564         ABC        00:00:00 93.91.192.232



我需要像这样:



and i need it to be like this:

109.127.100.33
109.127.104.75
93.91.192.232




任何建议都会有所帮助,
再次感谢




any advice will be helpful,
thanks again

推荐答案

朋友,

hi friend,

private void button1_Click(object sender, EventArgs e)
        {
            string[] x = { "SUV 4402577816 ABC 00:00:00 109.127.100.33", "SUV 6651215553 ABC 00:00:00 109.127.104.75", "SUV 6651231564 ABC 00:00:00 93.91.192.232" };
            for (int i = 0; i<x.Length; i++)
            {
                string[] d = x[i].Split(' ');
                MessageBox.Show(d[4].ToString());
            }
        }



问候
sarva



regards
sarva




您需要阅读MSDN的几篇文章.您需要了解处理文件和字符串函数(例如split)的知识.

MSDN:有关读取文本文件的信息 [ ^ ]

MSDN:String.split方法示例 [
Hi,

You need to go though couple of articles of MSDN. You need knowledge of handling files and string functions like split.

MSDN: Information on Reading Text File[^]

MSDN : String.split method example[^]

Read all related links from MSDN and try something yourself. I know you can do this.

Best of luck
Thanks
-Amit Gajjar


它将出现一个字符串,您需要在environment.newline上拆分.然后,您可以使用每个字符串的substring方法对其进行修剪.然后,您可以清除该框并遍历字符串,将它们添加到框中,并在它们之间再次使用Environment.NewLine.

对于编程新手"来说,这太复杂了,您应该上课,学习更多基础知识.
It will come a string, you need to split on environment.newline. Then you can use the substring method of each string to trim it. And then you can clear the box and iterate over the strings, adding them to the box, with Environment.NewLine between them again.

This is too complex for someone who is ''new to programming'', you should be in class, learning more basic things.


这篇关于在richtextbox中剪切一个特定的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆