VB常用函数收集[11.15更新...]
来源:互联网 发布:软件测试教程教学大纲 编辑:程序博客网 时间:2024/05/22 09:45
去掉所有HTML标记
Function FilterHTML(str,strlen)
Dim re
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<(.[^>]*)>"
str=re.Replace(str,"")
set re=Nothing
Dim l,t,c,i
l=Len(str)
t=0
For i=1 to l
c=Abs(Asc(Mid(str,i,1)))
If c>255 Then
t=t+2
Else
t=t+1
End If
If t>=strlen Then
cutStr=left(str,i)&"..."
Exit For
Else
cutStr=str
End If
Next
cutStr=Replace(cutStr,chr(10),"")
cutStr=Replace(cutStr,chr(13),"")
End Function
判断字符串是否是合法的EMail
Public Function IsValidEmail(strEmail As String) As Boolean
Dim names, name, i, c
IsValidEmail = True
names = Split(strEmail, "@")
If UBound(names) <> 1 Then
IsValidEmail = False
Exit Function
End If
For Each name In names
If Len(name) <= 0 Then
IsValidEmail = False
Exit Function
End If
For i = 1 To Len(name)
c = LCase(Mid(name, i, 1))
If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 And Not IsNumeric(c) Then
IsValidEmail = False
Exit Function
End If
Next
If Left(name, 1) = "." Or Right(name, 1) = "." Then
IsValidEmail = False
Exit Function
End If
Next
If InStr(names(1), ".") <= 0 Then
IsValidEmail = False
Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 And i <> 3 Then
IsValidEmail = False
Exit Function
End If
If InStr(strEmail, "..") > 0 Then
IsValidEmail = False
Exit Function
End If
End Function
- VB常用函数收集[11.15更新...]
- 常用的函数收集(实时更新)
- SQL2000 中常用的函数收集(持续更新)
- 收集的常用的sql函数、命令、、、、努力更新中、、、、
- 常用js函数收集(持续更新中----)
- vb.net常用函数
- vb.net常用函数
- vb.net常用函数
- vb.net常用函数
- vb.net常用函数
- VB常用函数
- VB常用函数
- VB常用函数
- VB常用字符串函数
- [VB]常用函数
- vb常用内部函数
- vb.net常用函数
- vb.net常用函数
- Visual Basic 编程问题解答
- 用ASP写的一个转换程序
- 如何编写高质量的VB代码
- 使用Session记录页面地址和实现页面返回功能
- VB中代码创建数据库
- VB常用函数收集[11.15更新...]
- Windows XP优化技巧大集合
- VBS中Space函数的应用
- 也谈中外程序员的差别
- 应用Struts的网站建设
- 指针函数和函数指针的区别
- C语言复习之文件操作(上)
- XHTML学习笔记(1)
- XHTML学习笔记(2)