C ++ string, string
C ++ string:
1. character array: Use the null character '\ 0' to terminate the string char greeting [6] = {'h', 'E', 'l', 'l', 'O ', '\ 0'}; or char greeting [] = "Hello ";
Function operation:
1 strcpy (s1, s2); copy string s2 to string s1.
2 strcat (s1, s2); connects string s2 to the end of string s1.
3 strlen (s1); returns the length of string s1.
4 strcmp (s1, s2); If s1 and s2 are the same, 0 is returned; If s1 <s2, the return value is smaller than 0; If s1> s2, the return value is greater than 0.
5 strchr (s1, ch); returns a pointer pointing to the first occurrence of the character ch in string s1.
6 strstr (s1, s2); returns a pointer pointing to the first position of string s2 in string s1.
2. String class: Standard Library header file <string>
Function operation:
1str2 = str1; copy string s2 to string s1.
2str3 = str1 + str2; connect string s2 to the end of string s1.
3str1. size (); returns the length of string s1.
4 str1.append () add characters to the end of the string
5str1. find () Search for strings in strings
6 str1.insert () insert characters
7 str1.length () returns the length of the string.
8 str1.replace () replacement string
9 str1.substr () returns a substring.
10...