去掉所有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=0for 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常用內部函式
1 數學函式 函式函式全稱 函式解釋 abs x 絕對值函式 absolute value function 計算x的絕對值,x為一個數值表示式 sgn x 符號函式 sign function 該函式的功能是判斷x的符號。當x 0時,函式值為1 當x 0時,函式值為 1 當x 0時,函式值為0 e...
vb常用內部函式
1。替換 replace函式 返回一個字串,該字串中指定的子字串已被替換成另一子字串,並且替換髮生的次數也是指定的。語法 replace expression,find,replacewith start count compare replace函式語法有如下幾部分 部分 描述 expressio...
erlang常用函式收集
1 消重演算法 plain view plain copy 1 list 1,2,3,1,2,4 1,2,3,1,2,4 2 sets to list sets from list list 3,2,1,4 2 排序演算法 plain view plain copy 3 lists sort lis...
集 erlang常用函式收集
1 消重演算法 1 list 1,2,3,1,2,4 1,2,3,1,2,4 2 sets to list sets from list list 3,2,1,4 2 排序演算法 3 lists sort list 1,1,2,2,3,4 根據某一元素排序 fun6 lists sort sort,...
常用函式庫收集
unsigned long resolv char host else host ip u long hp h addr return host ip 校驗和演算法 unsigned short checksum unsigned short buffer,int size if size cksu...