1, DateTime Digital
System.datetime CurrentTime = new system.datetime ();
1.1 Take the first day of the month
CurrentTime = system.datetime.now;
1.2 taken the previous year
INT year = currenttime.year;
1.3 take the previous month
Int month = currenttime.month;
1.4 Take the day
INT day = currenttime.day;
1.5 Take the current time
INT = currenttime.Hour;
1.6 take the front part
INT = CURRENTTIME.MINUTE;
1.7 take the second second
INT second = currenttime.second;
1.8 takes the current millisecond
INT millisecond = currenttime.millisecond; (variable can be available in Chinese)
2, int32.parse (variable) INT32.PARSE ("constant")
Character conversion to 32-bit digital
3, variable .tostring ()
Character conversion to string
12345.Tostring ("n"); // Generate 12,345.00 12345.toString ("c"); // Generate ¥ 12,345.00 12345.toString ("e"); // Generate 1.234500E 004 12345.toString ("f4" ); // Generate 12345.0000 12345.toString ("x"); // Generate 3039 (16) 12345.toString ("P"); // Generate 1,234,500.00%
4, variable .length digital type
Take a string length:
Such as: string str = "China"; int LEN = str.length; // LEN is a custom variable, Str is a variable name of the string of the measurement
5, System.Text.Encoding.default.getbytes (variable)
The word conversion is converted to a specific code such as byte [] byTStr = system.text.Encoding.default.get object (STR); then get the bit length: len = bytstr.length;
6, System.Text.StringBuilder ("" ")
The string is added, ( is not the same?)
Such as: system.text.stringbuilder sb = new system.text.stringbuilder (""); sb.append ("China"); sb.append ("people"); sb.append (Republic ");
7, variable. Substring (parameter 1, parameter 2);
Part of the interception string, the parameter 1 is the left start bit number, and the parameter 2 is a few digits.
Such as: string s1 = str.substring (0, 2);
8, string user_ip = request.servervariables ["remote_addr"]. TOSTRING ();
Take a remote user IP address
9, pass the proxy server to take a remote user real IP address: if (Request.ServerVariables ["http_via"]! = Null) {string user_ip = request.serverVariables ["http_forwarded_for"]. Tostring ();} else {string user_ip = Request.servervariables ["remote_addr"]. TOSTRING ();} 10, session ["Variable"]; Access Session Value;
Value: Object objName = session ["Username"]; string strname = objName.toTString (); empty: session.removeall ();
11, string str = request.QueryString ["Variable"]; use hyperlink to transfer the variable. If you build a hyperlink in either page: Click in edit.aspx page: string str = request.queryString ["fdid"];
12, DOC object .CreateElement ("New Name Name"); Create a new node of XML document
13, parent node .Appendchild (child node); add the new child node to the XML document parent node
14, parent node. Removechild (node); delete node
15, response response.write ("string"); response.write (variable); output to the page. Response.Redirect ("URL Address"); Jump to the page specified by the URL
16. Char.iswhitespce - logical check specify whether the location is empty; such as: string str = "Chinese people"; response.write (str, 2)); // The result is: True, the first character is 0 bits, 2 is the third character.
17. Char.Ispunctuation ('character') - logical symbols are punctuation, such as: response.write (char.ispunctuation ('a')); // Return: false
18, (int) 'characters' turn the character into a number, check the code point, pay attention to the single quotation. Such as: response.write (int) '); / / The result is the code: 20013
19, (char) code converts the number into characters, checks the characters represented by the code. Such as: response.write ((char) 22269); // Returns the word "country".
20, TRIM () Clear String Space
21, string variable.Replace ("Sub-string", "replace") string replacement, such as: string str = "China"; str = str.replace ("Country", "Central"); // Put national characters Change to CCR RESPONSE.WRITE (STR); // Output results are "central"
Another example: (this very practical) string str = "This is