One, MSDN description
String class: Represents text, which is a series of Unicode characters
Namespaces: System
Assembly: mscorlib.dll
Inheritance Relationship:
Note:
1. A string is an ordered collection of Unicode characters that is used to represent text. A string object is an ordered collection of System.Char objects that represent strings.
2. The value of the string object is the contents of the ordered collection, and the value is immutable, so the string object is called an immutable
stringSTR1 ="3"+"b"The sentence is designed to 1 string objectsusingSystem;classapp{Static voidMain () {//This piece of code creates 3 string objects stringstr ="a"; STR+="1"; STR+="3"; Console.WriteLine (str. Length); }}/*. Method private hidebysig static void Main () CIL managed{. entrypoint//code size (0x20). Maxstack 2. Local S init (string v_0) Il_0000:nop il_0001:ldstr "A" il_0006:stloc.0 il_0007:ldloc.0 il_0008:ldstr " 1 "Il_000d:call string [Mscorlib]system.string::concat (String, String) il_0012:stloc.0 il_0013:ldloc.0 il_0014:ldstr "3" Il_0019:call string [mscorlib] System.string::concat (String, string) il_001e:stloc.0 Il_ 001f:ret}//End of method App::main*/The ldstr instruction above is the instruction to create a string object on the heapView Code
3. For places where string values need to be modified frequently, use the System.Text.StringBuilder
4. String and string relationships: string is a string (System.String) alias in C #
Common attributes (with fields) and methods
Property:
Length: Gets the number of characters in the current String object
Empty: Represents a null string. This field is read-only.
static method:
IsNullOrEmpty
Isnullorwhitespace
Format
Compare
Instance method
Contains whether a string is included
Startwith the beginning of a string
Endwith End With a string
equals is equal to a string of XXX
IndexOf returns the first index matching a specified character (string)
Trim remove the kinsoku whitespace characters
Split splits the original string into a character array with a substring
Substring intercept string
ToLower variable Lowercase
ToUpper to uppercase
Equals (String) Determines whether this instance has the same value as another instance
Not finished
Probe into the source--system.string of class library