Some small functions that may be used in ASp +

Source: Internet
Author: User

/*
Tofu is made of excellent products
Http://www.asp888.net bean curd technology station
If you post this article, please retain the copyright information
*/

<Script language = "vb" runat = "server">
Public Function DateDemo ()
Get the date of today
Dim dt as datetime
Dim s as string
S = "today is :"
Dt = Now ()
S = s & dt. year () & "year"
S = s & (dt. month () + 1) & "month"
S = s & dt. Day () & "Day"
Return s
End Function
</Script>
Call the current system time in C #
Using System. Globalization;

DateTime dt = DateTime. Now;
String now = dt. Format ("f", DateTimeFormatInfo. CurrentInfo). ToString ();
Converts a string to an integer.
String v = "24 ";
Int x = v. ToInt32 ();

Obtain the visitor Ip Address

<% @ Page Language = "C #" %>
<%
String var;
Var = Request. ServerVariables ["REMOTE_ADDR"];
Response. Write ("REMOTE_ADDR =" + var + "<br> ");
%>
In C #, replace the content in another string with the specified string
Using System;
Using System. Text. RegularExpressions;

String myString;
MyString = "This is a test .";
MyString = Regex. Replace (myString, "is", "was ");

Author: tofu ()


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.