C # class

Source: Internet
Author: User
Tags add minutes

String class

(small blackboard hand without brackets small square brackets)

String. Length after length without parentheses output int type character Segment bytes

String. TrimStart ()-Remove the front space
String. TrimEnd ()-Remove the trailing space string. Trim ()-Remove the trailing space string

String. ToUpper ()-Capitalize lowercase letters in a string
String. ToLower ()-Converts uppercase letters in a string into lowercase

String. SubString (a); -Intercept the string, a-the subscript to begin intercepting, including the characters corresponding to the subscript
String. SubString (A, b); -A-starting from the first few subscripts, B-to intercept several characters

Used to intercept the ID must be within the index range or the program will crash unexpectedly

. IndexOf ("string"); -Returns the index of the first occurrence in the string, if no match is returned-1 finds the first index of the string that corresponds to the int type
int B = S.indexof ("string", S.indexof ("string") +1); Gets the second match, with the index of the second string being repeatedly found

String. LastIndexOf ("string"); -Returns the index of the last occurrence

String. Startwidth ("string"); -Determine whether to start with what
String. Endswidth ("string"); -Determine whether to end with what
String. Contains ("string"); -Determine if a string is included
S.replace (the string to replace, the replacement string); -Character substitution string
S.remove (3); -Remove all characters from index to end of string

Math Type

Math.pow (x, y); -to seek the Y-square of the second square x

MATH.SQRT (x); -square root radical under X

Math.ceiling (double); -Take the upper limit to marry a decimal of the maximum integer value 10.01=11

Math.floor (double); -Take the minimum value 10.1=10

Math.Round (double); 4 5 into when an integer is an odd number. 5 upper when Integer is even

=math.abs (double); -Take absolute value

DateTime class

DateTime Variable name = new DateTime (); -Define a variable time

DateTime.Now; -Get the current time of this PC

. ToString ("Format"); -Set date formatting, (year month months day)
yyyy-mm-month dd-day hh-12 hour HH-24 system hours mm-minutes ss-seconds ms-milliseconds

. AddYears (); -How many years are added on this time basis
. AddMonths (); -Increase Month
. AddDays (); -Increase Day
. AddHours (); -Increase hours
. AddMinutes (); -Add minutes
. AddSeconds (); -Add seconds

Adding time on the basis will automatically go up for example, plus 13 months will increase 1 years plus one months.

. year; -Gets the year of this time variable
. Month; -Get Month
. Day; -Day
. Hour; -Hour
. Minute; -Minute
. Second; -Seconds
. millisecond; -milliseconds alone to obtain this time of year and month day

. DayOfYear; -Get the current date is the day of the year such as February 5 is 36 days this year
. DayOfWeek; -Get the day of the week

TimeSpan type-time interval type
. Days-the difference in how many day
. Hours-How many hours the gap is in a day
. Minutes-How many minutes the gap in a day
. Seconds-How many seconds difference in a day
. Milliseconds-MS

. Total .... The cumulative gap is used to calculate the gap between month and day

C # class

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.