Reference type string commonly used for
1. Determine if a string is included
String A= "I ABCDEFG Love You";
Contains ("string");
BOOL Result=a.contais ("ABCDEFG")
Returns: true;
2. Splitter Split intercept field
String b= "ABCDEF&FGHIJ&KLMN";
string [] C=b.split ("&");
C[0]= "ABCdef";
C[1]= "Fghij";
C[2]= "KLMN";
3. Methods for connecting strings.
3.1 Concat
String stra= "Hello";
String strb= "world!";
String Newstr= ""; Here by the way remind yourself of string str=null;string str= ""; In a word, the former does not allocate memory, and the latter opens up a "" memory space for Str.
Newstr=concat (Stra, "", STRB);
Output value: Hello world!
3.2Join
String stra= "Hello";
String strb= "world!";
String Newstr= "";
String[] A={STRA,STRB};
Newstr=string.join ("", a);
Output value: Hello word!
3.3 "+" it's not going to be said, because it's got to come together.
4. There is a split has the connection pit is also inserted insert (int insertindex,string value), the index is starting from 0
4.1 String stra= "Hello";
String strb= "world!";
String Newstr= "";
Newstr=stra. Insert (1,STRB);
Output value: Hworld!ell
5. Delete Remove () deletes the specified number of characters starting at the point where the string was established.
Remove (int stratindex,int count)
String stra= "Hello";
String Newstr= "";
Newstr=stra. Remove (1,3);
Output value: Ho
Also remembered A, Trim (); TrimStart (); TrimEnd (); Remove the empty string.
6. Replacing replace ();
Replace (char Oldchar,char Newchar);
String stra= "Hello";
String Newstr= "";
Newstr=stra. Replace ("ll", "R");
Output: Hero
7. Change the case
ToUpper ();
ToLower ();
C # String