ASP common string-handling functions

Source: Internet
Author: User


Class cls_fun
 private x,y,ii
  ' ==============================
  ' function name: Alertinfo
      with: Error display function
  ' parameter     Number: Error prompt content infostr, turn page gourl
  ' = = ========================
 public Function alertinfo (infostr,gourl)
  if gourl= "1" Then
   response.write "<script>alert ('" & Infostr & "); location.href= ' javascript: History.go ( -1) ';</script> '
  else
   response.write ' <script>alert (' "& Infostr &"); location.href= ' & Gourl & ' ';</script> '
  end If
   Response.End ()
 end function
 
  ' ==============================
  ' function Name: HTMLEncode
  ' for    : Character conversion function
  ' parameter     number: text to convert fstring
  ' = = ===========================


'==============================
' Function name: alertnum
' function: To determine whether a number (validation characters, not a number of prompts)
' Parameters: Text CHECKSTR to be judged, error hint ERRSTR
'==============================
Public Function Alertnum (CHECKSTR,ERRSTR)
If not IsNumeric (CHECKSTR) or checkstr= "" Then
Call Alertinfo (Errstr, "1")
End If
End Function

'==============================
' Function name: alertstring
' function: Judge string length
Parameters
' The text that needs to be judged CHECKSTR
' Limited shortest Shortlen
' Limit the longest longlen
' Authentication type Checktype (2-head limit, 1 minimum limit, 2 maximum limit)
' Too Short hint longstr
' Too long hint longstr,
'==============================
Public Function alertstring (checkstr,shortlen,longlen,checktype,shorterr,longerr)
If (checktype=0 Or checktype=1) and Stringlength (CHECKSTR) <shortlen Then
Call Alertinfo (Shortstr, "1")
End If
If (checktype=0 Or checktype=2) and Stringlength (CHECKSTR) >longlen Then
Call Alertinfo (Longstr, "1")
End If
End Function

'==============================
' Function name: alertnum
' function: To determine whether a number (validation characters, not a number of prompts)
' Parameters: Text CHECKSTR to be judged, error hint ERRSTR
'==============================
Public Function Shownum (CHECKSTR,ERRSTR)
If not IsNumeric (CHECKSTR) or checkstr= "" Then
Response.Write (errstr& "| | | | |")
Pageerr=1
End If
End Function

'==============================
' Function name: showstring
' function: Judge string length
Parameters
' The text that needs to be judged CHECKSTR
' Limited shortest Shortlen
' Limit the longest longlen
' Authentication type Checktype (2-head limit, 1 minimum limit, 2 maximum limit)
' Too Short hint longstr
' Too long hint longstr,
'==============================
Public Function showstring (checkstr,shortlen,longlen,checktype,shorterr,longerr)
If (checktype=0 Or checktype=1) and Stringlength (CHECKSTR) <shortlen Then
Response.Write (shorterr& "| | | | |")
Pageerr=1
End If
If (checktype=0 Or checktype=2) and Stringlength (CHECKSTR) >longlen Then
Response.Write (longerr& "| | | | |")
Pageerr=1
End If
End Function

A
'==============================
' Function name: Beselect
' Function: Judge Select option selected
' Parameter: Select1,select2
'==============================
Public Function Beselect (SELECT1,SELECT2)
If Select1=select2 Then
Beselect= "selected= ' selected '"
End If
End Function

'==============================
' Function name: Becheck
' Function: Judge Check option selected
' Parameter: Check1,check2
'==============================
Public Function Becheck (CHECK1,CHECK2)
If Check1=check2 Then
becheck= "checked= ' checked '"
End If
End Function

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.