K
kaferro
I need to find "DEL" in a string. Sometimes it will appear at the
beginning sometimes at the end. I test for its existence if pos is
greater than zero when using the string function find_last_of(). This
method worked fine until I encountered an unanticipated string value.
What is the best method to solve the problem that exists in the code
below where both find_last_of() return a positive value?
//determines if trade type is DEL
string s_transStatus="DEL";
int pos=0;
pos=s_transStatus.find_last_of("DEL");
cout << "\ns_transStatus=" << s_transStatus;
cout << "\npos=" << pos << endl;
s_transStatus="ELEC";
pos=0;
pos=s_transStatus.find_last_of("DEL");
cout << "\ns_transStatus=" << s_transStatus;
cout << "\npos=" << pos << endl;
beginning sometimes at the end. I test for its existence if pos is
greater than zero when using the string function find_last_of(). This
method worked fine until I encountered an unanticipated string value.
What is the best method to solve the problem that exists in the code
below where both find_last_of() return a positive value?
//determines if trade type is DEL
string s_transStatus="DEL";
int pos=0;
pos=s_transStatus.find_last_of("DEL");
cout << "\ns_transStatus=" << s_transStatus;
cout << "\npos=" << pos << endl;
s_transStatus="ELEC";
pos=0;
pos=s_transStatus.find_last_of("DEL");
cout << "\ns_transStatus=" << s_transStatus;
cout << "\npos=" << pos << endl;