20160421 string type; Date Time type mathematical type

Source: Internet
Author: User
Tags square root

13th Day

2016-04-21

I. String type

String

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

ToUpper ()-Turns the letter of the string into uppercase.

ToLower ()-Turns the letter of the string all lowercase.

StartsWith ("substring")-whether to start with "substring", is-true

EndsWith ("substring")-whether to end with "substring", is-true

Contains ("substring")-whether it contains "substrings", is-true

Substring (start position, length)-from the large string, intercept the small substring out.

IndexOf ("substring")-from the large string, locate the first occurrence of the substring. Returns an integer. If a string is not found in the large string, return-1

LastIndexOf ("substring")-from the large string, locate the last occurrence of the substring. Returns an integer. If a string is not found in the large string, return-1

ReplaceWith ("Substituted substring", "New substring"): Converts the string specified in a large string into another small string, returning the large string after the substitution.

Two. Date and Time type:

DateTime dt = new DateTime ();

DateTime dt = new DateTime (1999,2,12);

DateTime dt = new DateTime (1999,2,12,13,45,56);

DateTime dt = DateTime.Now; Get current time

Dt. Year,dt. Month,dt. Day,dt. Hour,dt. Minitue,dt. Second

Dt. DayOfWeek, dt. DayOfYear

Dt. Addxxxx ();

Dt. ToString ("formatted string")

Yyyy,yy-year mm,m-month dd,d-day hh,h mm,m minutes ss,s seconds

Expand:

For integral type, floating point type, there is also ToString ("formatted string") #,0.

Three. Mathematical operations

Math

Math.ceiling (decimal) returns the smallest integer greater than the current decimal number

Math.floor (decimal) returns the largest integer less than the current decimal number

Math.Round (decimal) rounding

Math.sqrt (value) to find square root

20160421 string type; Date Time type mathematical type

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.