Function compute-determines whether the input is a phone number.

Source: Internet
Author: User

Determines whether the input is a phone number.

Source code
--------------------------------------------------------------------------------
<%
'*************************************** ***************************************
* Do not delete ************** **************************
'
'Copyright notice: Copyright 2000 Nicolas P. ladieu, node I Internet Consulting
'
'This code is free for non-commercial cial use. Any specified cial usage or
'Duplication requires a licensing agreement from the author who may be
'Contacted at the following email address: nick@nodei.com
'
'The author assumes no responsibility for any damage caused by
'Proper or inproper use of 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 see 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
'''''''''''''''''''''''''''''''''''''''' '''''''
'''''''''''''''''''''''''''''''''''''''' '''''''
%>

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.