vbs怎么使用mid函数呢
2 回答
慕丝7291255
TA贡献1859条经验 获得超6个赞
Option Base 1
Dim s As String
'读取数据in4.dat中的数据并用s代替
Private Sub Command1_Click()
Open App.Path & "\in4.dat" For Input As #1
s = Input(LOF(1), #1)
Close #1
Text1.Text = s
End Sub
Private Sub Command2_Click()
Dim m As Integer
If Len(s) = 0 Then
MsgBox "请先使用“读数据”功能!"
Else
If Text1.SelLength = 0 Then
MsgBox "请先选中文本!"
Else
t = ""
For i = 1 To Text1.SelLength
c = Mid(Text1.SelText, i, 1)
If c <> " " Then
t = t + c
Else
If LCase(t) = "the" Then
m = m + 1
End If
t = ""
End If
Next i
Text2.Text = Str(m)
End If
End If
End Sub
添加回答
举报
0/150
提交
取消