#include <iostream> #include <string> #include <string.h> #include <stdlib.h> using namespace
Std
int main () {//find function return type Size_type string s ("=1234=abcd=amde");
string Flag;
String::size_type position;
Way one//find function returns the subscript position of JK in s ((position = s.find ("="))!= String::npos) {position++;
cout << "position =" << position << Endl;
Char buffer[32];
size_t length = s.copy (buffer,4,position);
Buffer[length] = ' the ';
cout << "buffer =" << buffer << Endl;
if (strcmp (buffer, "1234") = = 0) {break;
}//Mode two #if 0 flag = "=";
position=0;
int i=1; while ((position = s.find_first_of (flag, position))!= String::npos) {cout<< ' i= ' << i << ' position
= "<<position<<endl;
position++;
i++;
Const char* p = strstr (S.c_str (), "=");
Char buffer[32];
size_t length = s.copy (buffer,4,position);
Buffer[length] = ' the '; CoUT << "buffer =" << buffer << Endl;
if (strcmp (buffer, "1234") = = 0) {break; }} #endif}