ASP practical function Library source code (i)

Source: Internet
Author: User
The following code is my recent collation of the common code part, and I will release more practical code, please put your own code back, while I tidy up, thank you!
qq:393356
<%
' Determine if the file name is legitimate
Function Isfilename (Afilename)
Dim Serrorstr,inamelength,i
Isfilename=true
Serrorstr=array ("/", "", ":", "*", "?", "" "", "<", ">", "|")
Inamelength=len (Afilename)
If inamelength<1 Or inamelength=null Then
Isfilename=false
Else
For I=0 to 8
If InStr (Afilename,serrorstr (i)) Then
Isfilename=false
End If
Next
End If
End Function
' Get rid of consecutive carriage returns and spaces at the ends of a string
function Trimvbcrlf (str)
TRIMVBCRLF=RTRIMVBCRLF (Ltrimvbcrlf (str))
End Function
' Remove successive carriage returns and spaces at the beginning of the string
function Ltrimvbcrlf (str)
Dim Pos,isblankchar
Pos=1
Isblankchar=true
While Isblankchar
If mid (str,pos,1) = "" Then
Pos=pos+1
ElseIf Mid (str,pos,2) =vbcrlf Then
Pos=pos+2
Else
Isblankchar=false
End If
Wend
Ltrimvbcrlf=right (Str,len (str)-pos+1)
End Function
' Remove consecutive carriage returns and spaces at the end of the string
function Rtrimvbcrlf (str)
Dim Pos,isblankchar
Pos=len (str)
Isblankchar=true
While Isblankchar and pos>=2
If mid (str,pos,1) = "" Then
Pos=pos-1
ElseIf Mid (str,pos-1,2) =vbcrlf Then
Pos=pos-2
Else
Isblankchar=false
End If
Wend
Rtrimvbcrlf=rtrim (Left (Str,pos))
End Function
' To determine if an email is valid, return 1 to indicate the correct
Function Isemail (Aemail)
Dim Ilocat,v,ilength,i,checkletter
If InStr (Aemail, "@") = 0 Or InStr (Aemail, ".") = 0 Then
Isemail=0
EXIT FUNCTION
End If
Ilocat=instr (Aemail, "@")
If InStr (Ilocat,aemail, ".") =0 Or InStr (Ilocat+1,aemail, "@") >0 Then
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.