The following describes the methods of the string class in C:
1. string (char []) uses the specified string array to construct a new string object.
2. int Compare (string a, string B, bool case) when comparing strings a, B, and case are true, the case is case insensitive. When a> B returns a positive number, when a <B returns a negative number, a = B returns 0
3. bool EndsWith (string) determines whether the current string ends with the specified string
4. bool StartsWith (string) determines whether the current string starts with the specified string
5. int IndexOf () returns the position of the specified character or string in the current string
6. int LastIndexOf () returns the last matching position of the specified character or string
7. string Insert (int, string) inserts a specified string into the current string
8. string Replace (string, string) string replacement
9. string Remove (int, int) deletes a specified number of characters from the specified position
10. ToUpper () ToLower () string case-insensitive Conversion
11. string SubString (int, int) returns the specified number of strings starting from the specified position
The following example describes some methods:
String str1 = "Hello ";
String srr2 = "World ";
String Upper, str3;
Upper = str1.Upper (); // converts str1 to uppercase
Str3 = str1.Insert (str1.Length, str2); // The content of str3 is HelloWorld
Author: happy_rita