һС¶Î¹Ø¼ü´Ê·ÖÎö´úÂë(VB)
°ïÅóÓѸĵÄһС¶Î¹Ø¼ü´Ê·ÖÎö´úÂ룻 º¬Á½¸öµ¥´Ê¸´ºÏ¼ÆÊý
Private Function CollectWords() As Dictionary(Of String, Integer)
'Create a new dictionary
Dim table As New Dictionary(Of String, Integer)
'Prompt for the user
Console.WriteLine(
"Enter a line : ")
'Get the user's input
Dim input As String = Console.ReadLine()
'Split the line and make an array of words
Dim words As String() = input.Split()
Dim wordPrev As String = ""
'Search the array
For Each word In words
'We can get the lowercase, not necessary here
Dim wordKey As String = word.ToLower()
'If the dictionay contains the words
If table.ContainsKey(wordKey) Then
'increment
table(wordKey) = table(wordKey) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey, 1)
End If
Dim wordKey2 As String = (wordPrev + " " + word).ToLower()
If wordPrev <> "" Then
If table.ContainsKey(wordKey2) Then
'increment
table(wordKey2) = table(wordKey2) + 1
Else
'add a new word with a count of 1 in the dictionary
table.Add(wordKey2, 1)
End If
End If
wordPrev = word
Next
Return table
End Function
Ïà¹ØÎĵµ£º
VBµÄ´úÂë´æ´¢ÔÚÄ£¿éÖС£ÔÚVBÖÐÌṩÁËÈýÖÖÀàÐ͵ÄÄ£¿é£º´°ÌåÄ£¿é¡¢±ê׼ģ¿éºÍÀàÄ£¿é¡£
¡¡¡¡¼òµ¥µÄÓ¦ÓóÌÐò¿ÉÒÔÖ»ÓÐÒ»¸ö´°Ì壬ËùÓõijÌÐò¶¼×¤ÁôÔÚ´°ÌåÄ£¿éÖУ¬¶øµ±Ó¦ÓóÌÐòÅÓ´ó¸´ÔÓʱ£¬¾ÍÒªÁíÍ⸽¼Ó´°Ìå¡£×îÖÕ¿ÉÄÜÓм¸¸ö´°ÌåÖÐÓÐһЩ¹²Í¬¶¼ÒªÖ´ÐеĴúÂ룬ΪÁËÔÚÁ½¸ö´°ÌåÖв»²úÉúÖØ¸´´úÂ룬¿É´´½¨Ò»¸ö¶ÀÁ¢µÄÄ£¿é£¬ÓÃËüʵÏÖ´ú ......
Ä¿µÄÕÆÎÕÒ»¸ö¼òµ¥µÄVB³ÌÐòµÄ½¨Á¢¡¢±à¼¡¢µ÷ÊÔ¡¢ÔËÐкͱ£´æµÄ·½·¨¡£
²Ù×÷²½Öè ¢Å½øÈëVB»·¾³£¬Ð½¨¹¤³Ì¡£·½·¨ÊÇ£ºÈç¹û³öÏ֓н¨¹¤³Ì”¶Ô»°¿ò£¬ÔòÑ¡Ôñ“±ê×¼.EXE”²¢µã»÷[´ò¿ª]°´Å¦£»»òÕßÖ±½Óµã»÷²Ëµ¥[Îļþ]-[н¨¹¤³Ì]¡£¶¼»á³öÏÖÒ»¸öÃûΪ“Form1”µÄд°Ìå¡£
¢Æ´Ó±ê×¼¿Ø¼þ¹¤¾ßÀ¸ÖÐÏò´°Ìå¼Ó ......
Private Sub Command1_Click()
Dim dso As New XMLDSOControl
Dim doc As IXMLDOMDocument
Set doc = dso.XMLDocument
Dim rel As IXMLDOMNodeList
Set x = CreateObject("Microsoft.XMLHTTP")
x.Open "GET", "http://127.0.0.1:8080/emrb/Mrbmodel?action=dis&u ......
Function crypt(Action As String, Key As String, Src As String) As String
'Action
' E encrypts, D decrypts,
'Key is a unique string needed to en/decrypt (either
' hardcode or setup something for the user to enter.
'Src is the string to be en/decrypted.
On Error GoTo errHandl ......