Https://msdn.microsoft.com/zh-cn/library/84787k22 (v=vs.110). aspx
1, Compare
Basic methods
public static int Compare (string stra,string StrB)
Call
String.Compare (S1, S2)
Overload 1
public static int Compare (
String stra,string strb,bool ignoreCase //Ignore case)
Overload 2
public static int Compare (string stra,string strb,bool ignorecase,cultureinfo culture //An object that provides culture-specific comparison information)
2, CompareTo
Https://www.cnblogs.com/jhxk/articles/1733811.html
String.CompareTo syntax
public int CompareTo (
String StrB
CompareTo is seldom used, do not use CompareTo to compare two strings for equality, use Equals. 3. Equals
52446664
public bool Equals (string value);
public static bool Equals (string a,string b);
4. Formatting strings
public static string Format (string Format,object obj);
invocation Example
String. Format ("{0},{1}", STRA,STRB)
String. Format ("{0}:d", stra)//formatted date
5. Intercepting strings
public string substring (int startindex,int length);
6. Split string
Public string[] Split (param char[] separator);
7. Inserting and populating strings
public string Insert (int startindex,string value);
8. Padding string
Method 1:
Use String. PadRight ()
Method 2:
To customize a static method for a string to be padded:
public static string PadRight (string src, char C, Int32 totallength)
{
if (Totallength < src. Length)
return SRC;
return src + new String (c, totallength-src. Length);
}
Https://www.cnblogs.com/IamJiangXiaoKun/p/5737822.html
9. Delete a string
Str1. Remove (3); String str1 deleted from third bit
Str1. Remove (3,10); String str1 from the third bit, delete the number of bits 10 bits
10. Copying strings
Copy ()
Strb=string. Copy (stra)//copying character stra to STRB
11. Replace string
String Strb=stra.replace ("One", "one"); Replace one in string stra with one
C # Foundation (String)