'------------------------------ ' 判断一个串是否是域名 '------------------------------ function IsDomain( str ) 'On error resume next Dim Letters, i, c, L Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-:/.@~?#$%^&*()_=\|{}[];/" Str = Trim(str) L = Len(str) If L = 0 Then IsDomain = False Exit Function ElseIf L > 100 Then IsDomain = False Exit Function End If For i = 1 To L c = Mid(str, i, 1) If InStr(Letters, c) = 0 Then IsDomain = False Exit Function End If Next if InStr( str, "." ) = 0 then IsDomain = False Exit Function end If If left( str, 1 ) = "." or right( str, 1 ) = "." Then IsDomain = False Exit Function end if IsDomain = true if err then IsDomain = false err.clear end if end function