Console.WriteLine ("Enter character 1"); stringN1 =Console.ReadLine (); Console.WriteLine ("Enter character 2"); stringN2 =Console.ReadLine (); //lenght is the length of the obtained string//n1=n1. ToLower (); Into lowercase//N2 = n2. ToUpper (); into uppercase//StringComparison.OrdinalIgnoreCase Ignoring case if(N1. Equals (N2, StringComparison.OrdinalIgnoreCase)) {Console.WriteLine ("same"); } Else{Console.WriteLine ("not the same"); } console.readkey ();
1), Length: Gets the number of characters in the current string
2), ToUpper (): Convert characters to uppercase
3), ToLower (): Convert string to lowercase
4), Equals (lessontwo,stringcomparison.ordinalignorecase): Compares two strings, can ignore the case
5), Split (): Splits the string and returns an array of string types.
6), Substring (): resolves the string. Include the position to intercept at the time of interception.
7), IndexOf (): Determines where a string appears for the first time in a string, if no return-1, value type, and reference type are stored in memory.
8), LastIndexOf (): Determine the last occurrence of a string in the string, if not the same return-1
9), StartsWith (): Judging by .... Begin
10), EndsWith (): Judging by ... End
11), replace (): Replace a string in a string with a new string
12), Contains (): Determines whether a string contains the specified string
13), Trim (): Remove the space before and after the string
14), TrimEnd (): Remove the trailing space in the string
15), TrimStart (): Remove the preceding space in the string
16), String. IsNullOrEmpty (): Determines whether a string is empty or null
17), String. Join (): The array is concatenated with the specified string, returning a string.
Comparison of C # strings