【求助】vb.asp.net如何计算文本框2中所输入字符在文本框1中所出现的次数
如图所示
如何使用function得出Phrase2中输入字符在Phrase1中所出现的次数,谢谢!!
这是第一段代码
程序代码:
Protected Sub btnSearch_Click(sender As Object, e As System.EventArgs) Handles btnSearch.Click lblResult.Text = "Number of times the words in Phrase 2 textbox has been used in Phrase 1 textbox: <br><br>" Dim i As Integer Dim phraseArray2 As String() = tbPhrase2.Text.Split(" "c) For i = 0 To phraseArray2.Length - 1 lblResult.Text &= phraseArray2(i) & ": " & appears(phraseArray2(i)) & " time(s)<br>" Next End Sub
下面是第二段,不知道怎么写了。
Protected Function appears(ByVal String_To_Search_For As String) As String