Utility function: Determines whether the input is a phone number
Source: Internet
Author: User
function <%
'******************************************************************************
' ********************** do not DELETE ****************************************
'
' COPYRIGHT notice:copyright Nicholas P. Ladieu, node I internet consulting
'
' This code was free for non-commercial use. Any commercial usage or
' Duplication requires a licensing agreement from the author who
' contacted at the following email address:nick@nodei.com
'
' The author assumes no responsibility for all damage caused by the
' Proper or Inproper use the This code.
'
' Http://www.nodei.com
' ********************** do not DELETE ****************************************
'******************************************************************************
Function Isphone (X)
Dim Fieldok
Fieldok=true
For i = 1 to Len (X)
If IsNumeric (Mid (X, I, 1)) =false and Mid (x,i,1) <> "-" and mid (x,i,1) <> "(" and mid
(x,i,1) <> ")" Then
Fieldok=false
End If
Next
' "'" ' "'" ' now STRIP out CHARS and IF WE HAVE A VALID number
For I = 1 to Len (X)
Strcurrentchar = Mid (X, I, 1)
' Numbers (0 to 9)
If ASC ("0") <= ASC (STRCURRENTCHAR) and ASC (STRCURRENTCHAR) <= ASC ("9") Then
strtemp = strtemp & Strcurrentchar
End If
' Upper case Chars (A to Z)
If ASC ("A") <= ASC (STRCURRENTCHAR) and ASC (STRCURRENTCHAR) <= asc ("Z") Then
strtemp = strtemp & Strcurrentchar
End If
Next ' I
X=strtemp
If Len (X) =10 and left (x,1) = "1" Then
Fieldok=false
End If
If Len (X) <10 Then
Fieldok=false
End If
If Len (X) >11 Then
Fieldok=false
End If
Isphone=fieldok
End Function
'''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''
%>
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