本文介绍了如何计算富文本框VB.NET中链接文本的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何实现计算vb.net中富文本框内的超链接URL数量的能力或c#
我尝试了什么:
我没有尝试任何我需要帮助的东西
I was wondering how can you implement the ability to count the amount of hyperlink URLs that it’s inside a rich text box in vb.net or c#
What I have tried:
I haven’t tried anything I need help with it
推荐答案
public int GetNumberOfLink()
{
string[] links = rtb.Text.Split(' '); //Splits the text in your rtb when there's a space, and store every spilted element into a string array.
return links.Count(); //return the number of string in the array.
}
然后,可以这样调用:
then, it can be called this way:
public void SomeMethods()
{
//some code
int nbOfLinks = GetNumberOfLink();
//some code
}
这篇关于如何计算富文本框VB.NET中链接文本的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!