ASP Practical Function Library Source Code
<% 'Judging whether the file name is legal function isfilename (AfileName) DIM SERRORSTR, INAMALRORSTR = Array ("/", "/", ":", "*", "?", "" "", " <","> "," | ") INAMALELENGTH = LEN (AfileName) if inamelength = null dam1filename = false = false for i = 0 to 8 if instruction IF NEXTEND IFEND FUNCTION
'Continuous Enter and Spaces of the String Tail Function Trimvbcrlf (STR) Trimvbcrlf = RtrimVBCRLF (Ltrimvbcrlf (STR)) End Function
'Continuous carriage return and space of the start of string and space Function Ltrimvbcrlf (STR) DIM POS, isblankcharpos = 1isblankchar = truewhile isblankchar if MID (Str, POS, 1) = "" THEN POS = POS 1 Elseif MID (Str, POS , 2) = VBCRLF THEN POS = POS 2 else isblankchar = false end ifwendltrimvbcrlf = Right (STR, LEN (STR) -POS 1) End Function
'Continuous carriage return and space of the string of strings and space Function RTrimvbcrlf (STR) DIM POS, isblankcharpos = len (str) isblankchar = truewhile isblankchar and pos> = 2 if MID (Str, POS, 1) = "" "" " POS-1 elseif MID (STR, POS-1, 2) = VBCRLF THEN POS = POS-2 else isblankchar = false end ifwendrtrimvbcrlf = RTRIM (Left (STR, POS)) End Function
'Judging whether Email is valid, return 1 Represents the correct function ISEMAIL (AEMAIL) DIM ILOCAT, V, ILENGTH, I, CheckletterIF INSTR (AEMAIL, "@") = 0 or ISEMAIL, ") = 0 Then ISEMAIL = 0 EXIT FUNCTIONEND IFILOCAT = IF INSTR (iLocat, Aemail, ".") = 0 or Instr (iLocat 1, Aemail, "@")> 0 Then ISEmail = 0 exit functionend ifif Left (AEMAIL , 1) = "." Or right (aEmail, 1) = "." Or left (aEmail, 1) = "@" Or right (aEmail, 1) = "@" Then isEmail = 0 EXIT FUNCTIONEnd Ifv = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_ -. @ "inength = len (aemail) for i = 1 to ionch checkletter = MID (AEMAIL, I, 1) IF INSTR (v, checkletter) = 0 Then ISEMAIL = 0 exit function end ifnextisemail = 1END function 'test: display server information Sub showServerDim nameResponse.write "