From the location, say:
- 1, uppercase string is a string in the. NET framework, and a lowercase string is a string in the C # language
- 2. If you delete the using System, you cannot use uppercase String,system is a function name in the. NET Framework class Library
From the nature:
- 1. String is a keyword, string is a class, string cannot be the name of a class, struct, enumeration, field, variable, method, property
- 2, write code in C # as far as possible to use lowercase string, compared with the specification. If you can use uppercase strings in the pursuit of efficiency, because the lowercase string becomes the uppercase string after compilation, it can reduce the load for compilation and thus improve the efficiency of the operation.
- 3. String that represents Unicode character strings, string is an alias for string in the. NET framework, and is more intuitive to test for string equality
String Details:
string string // output value is 0
string S1 = string. A string variable that points to an empty string, S1 does not occupy storage space, and the S1 variable can be used
string string // output value is 0
String s2 = ""; an empty string pointing to "S2", which takes up a byte storage space because the escape character, \ n, is the end of the string, and the S2 variable can be used
string NULL // throws an exception of type ' System.NullReferenceException ' (that is, a null reference)
string s3 = ""; A variable that does not point to any storage space, S3 variable cannot be used
Single Character Segmentation:
string " ABCDEABCDEABCDE " ; string [] Sarray = S.split ('C'); foreach (string in sarray) { Console.WriteLine (i.tostring ());} // output The following result: Abdeabdeabde
Multiple character splits:
strings ="ABCDEABCDEABCDE";string[] SArray1 = S.split (New Char[3]{'C','D','e'});foreach(stringIinchsArray1) {Console.WriteLine (i.ToString ());}//output The following result:Ababab
Multiple-character segmentation (regular expressions):
string " Agcsmallmacsmallgggsmallytx " ; string " Small " , regexoptions.ignorecase); foreach (string in resultstring) { Console.WriteLine (i.tostring ());} // output The following result: Agcmacgggytx
The difference between string and string in C #