统计单词个数的vb程序

这两个空怎么填
2024-12-30 21:23:20
推荐回答(2个)
回答1:

1、zm(ss)

2、k=1

其实这个程序不用那么复杂,只要使用split函数用空格分割下句子,然后判断下有多少数组元素就好了!

Private Sub Command1_Click()

Dim s As String, b() As String

s = Text1

b() = Split(s, " ")

Text2 = "共有" & UBound(b()) + 1 & "个单词"

End Sub


Private Sub Form_Load()

Text1 = "i love you."

Text2 = ""

Command1.Caption = "统计"

End Sub

回答2:

1. zm(ss)=true
2. k=1