C # language classes

Source: Internet
Author: User

Tag: Dex DMI NEW * * Time () time date format character index

++++string class +++++
Small Black wrench-Properties
Purple Cube-Method


String. Length-string lengths, return int type

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

String. ToUpper ()-Converts lowercase characters in a string into uppercase string
String. ToLower ()-Becomes a lowercase string

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

Attention:????

String. IndexOf ("string"); -Returns the index of the first occurrence in a string if no match is returned-1 int
int B = S.indexof ("Day", S.indexof ("Day") +1); Get a second match, 3 4 5 6

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 class +++++
Math.pow (x, y); -Second party
MATH.SQRT (x); -square root

Math.ceiling (double); -Take the upper limit
Math.floor (double); -Lower Limit
Math.Round (double); -Rounding
Math.Abs (double); -Take absolute value

+++++datetime class +++++
DateTime Variable name = new DateTime (); -Definition

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

. ToString ("Format"); -Set date formatting,
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

. year; -Gets the year of this time variable
. Month; -Get Month
. Day; -Day
. Hour; -Hour
. Minute; -Minute
. Second; -Seconds
. millisecond; -Milliseconds

. DayOfYear; -Gets the current date is the day ordinal of the year
. DayOfWeek; -Get the day of the week

. TimeOfDay; -Get Time section
. Date; -Get Date part


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 .... Cumulative gap

String.Split ()

C # language classes

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.