asp電子郵件位址格式判斷函式

2021-04-13 01:45:50 字數 1240 閱讀 7402

function isvalidemail(email)

validflag = false

if (email <> "") and (instr(1, email, "@") > 0) and (instr(1, email, ".") > 0) then

atcount = 0

specialflag = false

for atloop = 1 to len(email)

atchr = mid(email, atloop, 1)

if atchr = "@" then atcount = atcount + 1

if (atchr >= chr(32)) and (atchr <= chr(44)) then specialflag = true

if (atchr = chr(47)) or (atchr = chr(96)) or (atchr >= chr(123)) then specialflag = true

if (atchr >= chr(58)) and (atchr <= chr(63)) then specialflag = true

if (atchr >= chr(91)) and (atchr <= chr(94)) then specialflag = true

next

if (atcount = 1) and (specialflag = false) then

badflag = false

tary1 = split(email, "@")

username = tary1(0)

domainname = tary1(1)

if (username = "") or (domainname = "") then badflag = true

if mid(domainname, 1, 1) = "." then badflag = true

if mid(domainname, len(domainname), 1) = "." then badflag = true

validflag = true

' 格式正確返回ture

end if

end if

if badflag = true then validflag = false

' 格式不正確返回false

isvalidemail = validflag

end function

如何收集電子郵件位址

一般來說,我們要收集電子郵件位址,可以通過採集和購買這兩種手段。本文博主為大家詳細介紹一下如何收集電子郵件位址。一,通過填寫網頁的活動資訊進行收集。比如我們要推出乙個活動,就可以使用這種方式將使用者的資訊收集起來。這樣,我們就可以在今後郵件營銷的時候拿出來使用了,進行精準營銷。二,通過網上收集,一般...

LeetCode 獨特的電子郵件位址

本體用了正則和非正則兩種方式,結果來說非正則快一點,用set去重都是一樣的。這裡吐槽一下leetcode有些通過 明顯是錯誤的,還是測試用例不完善的鍋啊。正則 public int numuniqueemails string emails temp 0 sb.tostring result.add...

C 校驗Email(電子郵件)位址是否合法

用於校驗給定的email位址是否合法,只針對用於提供的email位址的格式,不對其是否真實存在進行校驗。驗證email是否合法 要驗證的email public static bool isemail string email 清除要驗證字串中的空格 email email.trim 模式字串 st...