String post-add function

Source: Internet
Author: User

String type

String:

1.Trim ()-The space of the Kinsoku, the space in the middle cannot go.

2.Toupper ()- capitalize all the letters in the string.

3.Tolower ()- turns the letter of the string all lowercase.

4.startswith ("substring");- whether to start with a substring.

5.endswith ("substring");- whether to end with a substring.

6.contains ("substring");- whether the inside contains substrings.

7.substring ( starting position , length ); If the length is omitted, The Intercept ends. Intercepts small substrings from a large string. Position starting from 0

8.indexof ("sub-string"); from the large string, locate the first occurrence of the substring. Returns an integer. Returns -1 if no substring is found in the large string .

9.lasindexof ("sub-string"); from the large string, locate the last occurrence of the substring and return an integer.

10.replacewith ("Original letter", "replacement letter"); Replace the small string specified in the large string with another substring, returning the large string after the substitution.

Date Time Type:

DateTime dt = new DateTime ( year, month, day );

DateTime dt = new DateTime ();

DateTime dt = new DateTime ( year, month, day, time, minute, second );

DateTime dt = DateTime.   Now; Get current Time

Console.Write (dt.year); get Current year

Console.Write (Dt.month); Month

Console.Write (Dt.day); Day

Console.Write (Dt.hour); when

Console.Write (Dt.minitue) points ;

Console.Write (Dt.second); seconds

Console.Write (Dt.dayofweek); Day of the week

Console.Write ((int) dt.dayofweek); Number of days of the week.

Console.Write (dt.dayofyear); the day ordinal of a year

Console.Write (dt.addxxx ( digital )); how long after that day if it's negative is how long ago

Console.WriteLine (dt.tostring ("yyyy MM month dd day hh mm points SS seconds "));

For shaping, floating-point types, there is also ToString ("formatted string") only #,0. .

Console.WriteLine (c.tostring ("#,#")); three bit a comma

Console.WriteLine (c.tostring ("#,00")); 0 means no decimals, plus 0 .

Console.WriteLine (math.ceiling (3.14)); the smallest integer greater than the current decimal

Console.WriteLine (Math.floor (3.14)); maximum decimal number less than the current decimal

Console.WriteLine (Math.Round (3.14)); Rounding

Console.WriteLine (math.sqrt ( numeric )); Find square root

String post-add 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.