Char class:
1.strcpy (S1,S2); Copy the String S2 as the starting address into S2.
2.strncpy (s1,s2,k); copies the first k of the string S2 as the starting address into S1.
Char s1[],s2[];cin>>S2; int k=4; strncpy (s1,s2,k); S1[k]='n'; cout <<s1<<endl;
3.strstr (S1,S2); finds S2 in S1, returns the first occurrence if found, otherwise returns NULL.
Char s1[]={"ABC"},s2[]={"iiiabciii"}; Char* pos=strstr (S2,S1); if (pos!=null) printf ("%s\n", POS); // Output: ABCIII
4.STRCMP (S1,S2); Compares the size of S1 and S2 by dictionary order. The equivalent return 0;S1>S2 returns 1;S1<S2 returns-1.
5.STRNCMP (s1,s2,n); the STRNCMP function specifies the comparison of size characters. That is, if the string S1 is the same as the first size character of S2, the function returns a value of 0.
Char s1[]={"ABCDD"}; Char s2[]={"ABC"};p rintf ("%d\n", STRNCMP (S1,S2,3));
String class:
1. STRING.C_STR ();
The const char* type is returned;
string s;cin>>s; Const Char* str=s.c_str ();p UTS (str);
Summary of string correlation functions