Private Sub Command1_Click()
Dim s As String, s1 As String
s = InputBox("l")
Text1.Text = ""
Open App.Path + "\wls.txt" For Input As #1
While Not EOF(1)
Input #1, s1
If s = Left(s1, Len(s)) Then
If Len(Text1.Text) < 255 Then
Text1.Text = Text1.Text + s1
Else
Text1.Text = Left(Text1.Text, 255)
End If
End If
Wend
Close #1
End Sub
这段代码是计算以输入拼音为开头的拼音后文字的个数的代码,但是我的这段代码没法去掉字符和空格也把他们计算在内了
我输入a则应该显示以a开头所以拼音后面的文字,但是文字的个数不超过255,但是现在文字只有171字符数是207计空格的是254也就是代码把拼音和空格都计算在内了,现在我想去掉拼音和空格占的位置只计算文字
Dim s As String, s1 As String
s = InputBox("l")
Text1.Text = ""
Open App.Path + "\wls.txt" For Input As #1
While Not EOF(1)
Input #1, s1
If s = Left(s1, Len(s)) Then
If Len(Text1.Text) < 255 Then
Text1.Text = Text1.Text + s1
Else
Text1.Text = Left(Text1.Text, 255)
End If
End If
Wend
Close #1
End Sub
这段代码是计算以输入拼音为开头的拼音后文字的个数的代码,但是我的这段代码没法去掉字符和空格也把他们计算在内了
我输入a则应该显示以a开头所以拼音后面的文字,但是文字的个数不超过255,但是现在文字只有171字符数是207计空格的是254也就是代码把拼音和空格都计算在内了,现在我想去掉拼音和空格占的位置只计算文字
解决方案 »
- VB下的AES加密问题,请高手进来看看
- 如何枚举DATAGRID的所有行信息?
- 在listview中多选的时候怎么将多选的数据存放到数组中呢?
- VB调用java
- ImageCombo控件如何添加图片?急!在线等待!
- 我想要一个可以播放flash的控件
- 哪位大哥给个塑胶制品厂的能力计划方面给我?谢谢 [email protected]
- (菜鸟求助)请问用vb怎样求矩阵某一列向量的平均值?
- 发现ImageList的重大Bug,会迅速耗尽内存!!!
- vb程序编完有source htmlhelp setup文件夹怎么生成exe运行程序
- 问一个加载图像的问题
- 如何将某个已经安装好的应用程序的DLL文件加载到VB中
dim lLength as long
dim i as long
if len(text) <= MaxLength then
LeftX = Text
Exit Function
end if
for i=1 to Len(Text)
select case asc(mid$(Text,i,1))
case 0 to 255
case else
lLength = lLength +1
if lLength >= MaxLength then exit for
end select
next
LeftX = Left(Text, i)
end sub'先将所有的字符串都拼起来,最后用下面的方式保留255个文字
Text1.Text = LeftX(Text1.Text)
Private Sub Command1_Click()
Dim s As String, s1 As String
s = InputBox("l")
Text1.Text = ""
Open App.Path + "\wls.txt" For Input As #1
While Not EOF(1)
Input #1, s1
If s = Left(s1, Len(s)) Then
Text1.Text = Text1.Text & s1 & vbCrLf
End If
Wend
Close #1
Text1.Text = LeftX(Text1.Text, 255)
End Sub