Digital mail, telephone, fax, zip code, address verification code

Source: Internet
Author: User

Digital mail, telephone, fax, zip code, address verification code

# Region verify that the input string is a number
/// <Summary>
/// Verify that the input string is a number
/// </Summary>
/// <Param name = "p_str_num"> input character </param>
/// <Returns> returns a Boolean value. </returns>
Public bool validatenum (string p_str_num)
{
Return regex. ismatch (p_str_num, "^ [0-9] * $ ");
}
# Endregion

# Region verification the input string is the phone number
/// <Summary>
/// Verify that the input string is a phone number
/// </Summary>
/// <Param name = "p_str_phone"> input string </param>
/// <Returns> returns a Boolean value. </returns>
Public bool validatephone (string p_str_phone)
{
Return regex. ismatch (p_str_phone, @ "d {3, 4}-d {7, 8 }");
}
# Endregion

# Region verification the input string is a fax number
/// <Summary>
/// Verify that the input string is a fax number
/// </Summary>
/// <Param name = "p_str_fax"> input string </param>
/// <Returns> returns a Boolean value. </returns>
Public bool validatefax (string p_str_fax)
{
Return regex. ismatch (p_str_fax, @ "86-d {2, 3}-d {7, 8 }");
}
# Endregion

# Region verification input string is zip code
/// <Summary>
/// Verify that the input string is a zip code
/// </Summary>
/// <Param name = "p_str_postcode"> input string </param>
/// <Returns> returns a Boolean value. </returns>
Public bool validatepostcode (string p_str_postcode)
{
Return regex. ismatch (p_str_postcode, @ "d {6 }");
}
# Endregion

# Region verify that the input string is an e-mail address
/// <Summary>
/// Verify that the input string is an email address
/// </Summary>
/// <Param name = "p_str_email"> input string </param>
/// <Returns> returns a Boolean value. </returns>
Public bool validateemail (string p_str_email)
{
Return regex. ismatch (p_str_email, @ "w + ([-+. '] w +) * @ w + ([-.] w + )*. w + ([-.] w + )*");
}
# Endregion

# Region verify that the input string is a network address
/// <Summary>
/// Verify that the input string is a network address
/// </Summary>
/// <Param name = "p_str_naddress"> input string </param>
/// <Returns> returns a Boolean value. </returns>
Public bool validatenaddress (string p_str_naddress)
{
Return regex. ismatch (p_str_naddress, @ "http (s )? : // ([W-] +.) + [w-] + (/[w -./? % & =] *)? ");
}
# Endregion

# Automatically numbered region
/// <Summary>
/// Automatic ID
/// </Summary>
/// <Param name = "p_str_sqlstr"> SQL statement </param>
/// <Param name = "p_str_table"> data table name </param>
/// <Param name = "p_str_tbcolumn"> data table field </param>
/// <Param name = "p_str_codeindex"> string before the serial number </param>
/// <Param name = "p_str_codenum"> Number following the serial number </param>
/// <Param name = "txt"> textbox Control name </param>
Public void autonum (string p_str_sqlstr, string p_str_table, string p_str_tbcolumn, string p_str_codeindex, string p_str_codenum, textbox txt)
{
String p_str_code = "";
Int p_int_code = 0;
Dataset myds = boperate. getds (p_str_sqlstr, p_str_table );
If (myds. tables [0]. rows. count = 0)
{
Txt. text = p_str_codeindex + p_str_codenum;
}
Else
{
P_str_code = convert. tostring (myds. tables [0]. rows [myds. tables [0]. rows. count-1] [p_str_tbcolumn]);
P_int_code = convert. toint32 (p_str_code.substring (2, 7) + 1;
P_str_code = p_str_codeindex + p_int_code.tostring ();
Txt. text = p_str_code;
}
}
# Endregion

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.