Hi all

I am trying to search a string to see whether one of four operators symbols (+,-,* or/) is in the string. The code i am currently using is below, however if the operator symbol i am searching for is not found a debug error occurs during the execution of the code. I think it is something to do with what is returned by the if statement if it is not found. can anyone help.

string op = "";
string plus = "+";
string minus = "-";
string mult = "*";
string div = "/";

int check_plus = -1;
int check_minus = -1;
int check_mult = -1;
int check_div = -1;

check_plus = plus.compare(command.substr(command.find('+') , command.find('+') - (command.find('+') - 1)));
check_minus = minus.compare(command.substr(command.find('-') , command.find('+') - (command.find('-') - 1)));
check_mult = mult.compare(command.substr(command.find('*') , command.find('+') - (command.find('*') - 1)));
check_div = div.compare(command.substr(command.find('/') , command.find('+') - (command.find('/') - 1)));

where command is my string being ENGAGE number=3+3


I have also tried implementing it using stringname.at() method to but with the result being the same problem.

cheers in advance

Jos