Public Function FilterStr(str_Src As String) As String
Dim str_Ret As String
Dim AscCode As Integer
For i = 1 To Len(str_Src)
AscCode = Asc(Mid$(str_Src, i, 1))
If (AscCode <> 9 And AscCode <> 13 And AscCode <> 10 And AscCode <> 32 And AscCode <> 0 And AscCode <> -24159) Then
str_Ret = str_Ret & Chr$(AscCode)
End If
Next i
FilterStr = str_Ret
End Function
Dim str_Ret As String
Dim AscCode As Integer
For i = 1 To Len(str_Src)
AscCode = Asc(Mid$(str_Src, i, 1))
If (AscCode <> 9 And AscCode <> 13 And AscCode <> 10 And AscCode <> 32 And AscCode <> 0 And AscCode <> -24159) Then
str_Ret = str_Ret & Chr$(AscCode)
End If
Next i
FilterStr = str_Ret
End Function
解决方案 »
- 判断选择的路径是否包含 某些字符
- 如何把注册表中unistall的displayname 显示出来?(100分)
- Scroll 中现显 Picture ..
- 如何捕捉MSHFlexGrid控件改变列宽度时的消息??MouseDown()事件好象没有用啊?~~~各位帮帮忙!
- 非常急!!如何在form1框架里面添加exe程序。
- 请问前辈:
- 谁有全国邮政编码的数据库?急需
- 请问高手如果要接收计算机串口传来的数据(通过定期刷新)在VB里应该调用什么函数?
- Dbgrid32.ocx控件不能使用,求解?
- ★★★哪位老兄帮手,关于winsock!!!
- 求一段VB程序的含义(3),delphi程序员的HELP
- VB runtime运行库的问题 急!!!!!!!!!
9为Tab,10为换行,13为回车,32为空格
Dim str_Ret As String
Dim AscCode As Integer
For i = 1 To Len(str_Src) //从1到字符串的长度循环
AscCode = Asc(Mid$(str_Src, i, 1)) //取每一位的ASCII码(在非 DBCS 系统下,返回值范围为 0 – 255 。在 DBCS 系统下,则为 -32768 – 32767。)
If (AscCode <> 9 And AscCode <> 13 And AscCode <> 10 And AscCode <> 32 And AscCode <> 0 And AscCode <> -24159) Then //当前字符如果不符合条件则过滤
str_Ret = str_Ret & Chr$(AscCode) //符合条件的字符拼成字符串
End If
Next i
FilterStr = str_Ret //设置函数等于字符串(即返回值为过滤后的字符串)
End Function