ASP common string-handling functions

Source: Internet
Author: User

Class cls_fun
 private x,y,ii
 ==============================
  function name: Alertinfo
      use: Error display function
  parameter     number: Error hint 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
  Make     Using: Character conversion function
  parameter     number: text fstring
 ==============================

to convert


==============================
Function Name: Alertnum
Role: 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
Role: Determine string length
Parameters
Text CHECKSTR to be judged
Limited to the shortest shortlen
Limit the longest Longlen

  Authentication Type Checktype (2-head limit, 1 shortest limit, 2 maximum)
  short hint longstr
  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
  for     use: To determine whether a number (a validation character, not a number of prompts)
  parameter      Number: Text CHECKSTR to be judged, error prompts 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
  for    : judging string length
  Parameters     Number:
  The text to be judged Checkstr
  Limited to the shortest Shortlen
  Limited Longlen
  Authentication type Checktype (2-head limit, 1 minimum, 2 maximum limit)
  short hint longstr
  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) >lon GLen Then
   Response.Write (longerr& "| | | | |")
   pageerr=1
  End If
 end Function
 
a
 ======================== = = = = = = = = = = = = =
  Function name: Beselect
  for     use: Judge Select option Select
  parameter     number: Select1, Select2
 ==============================
 public Function beselect (select1,select2)
  If select1= Select2 Then
   beselect= "selected= ' selected '"
  end If
 end Function
 
&nb sp;==============================
  Function name: Becheck
  for     use: Check option select
  parameter     Number: 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.