易截截图软件、单文件、免安装、纯绿色、仅160KB

一小段关键词分析代码(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 For循环的一个特点

无意中发现VB For循环的一个特点:在循环体中,企图改变循环终止变量使之提前退出循环是徒劳的。
Private Sub Form_Load()
  Dim s(0 To 4) As String
  Dim N As Integer, i As Integer
  s(0) = "测试1"
  s(1) = "测试2"
  s(2) = "测试3"
  s(3) = "测试4"
  s(4) = "测试5 ......

VB获取窗口地址栏内容

http://zhidao.baidu.com/question/84802747.html
VB如何获取窗口地址栏内容
就是比如我打开D盘的aaa文件夹,窗口地址栏就是显示D:\aaa,请问我要怎么用VB写程序来获取窗口地址栏的内容?(不是IE的地址栏)
若打开了两个窗口,比如D盘的aaa文件夹和E盘的bbb文件夹下的ccc文件夹都打开的话,点击command1,text1就显示: ......

VB设计动画时钟

 VB设计动画时钟
程序名:Sec-Time.vbp
程序类别:完整的VB程序
功能:显示一个动画时钟,该时针随着每一秒而动态变化。
程序说明
1.如何画时钟表盘上的所有直线元素?
用Load命令建立原始Line控制的14个拷贝(因为表盘有12个点和时、分、秒共15个Line),该控制数组每一个实例的端点坐标属性设置为每条线在时 ......

vb常用字符串处理函数

1. ASC(X),Chr(X):转换字符字符码   
[格式]:   
P=Asc(X) 返回字符串X的第一个字符的字符码   
P=Chr(X) 返回字符码等于X的字符   
[范例]:   
(1)P=Chr(65)   
‘ 输出字符A,因为A的ASCII码等于65   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号