String Find Issues on passed by reference parameter
Hi guys,
Im struggling with a simple string find function.
I am using OnChartEvent handler, and my idea is to take the sparam and search it for a string, for example search for "Remove" in the object name, if there was a click on an object(button) on the chart. But the string find always returns 0 ! I printed the sparam, and its ok, it contains the word i am searching for(i have accounted for the uppercase), so this is my problem. Maybe the thing is that sparam is passed by reference, i am not sure.
Id appreciate it if someone helps !
Thanks
void OnChartEvent(const int id, // Event identifier const long& lparam, // Event parameter of long type const double& dparam, // Event parameter of double type const string& sparam) // Event parameter of string type { if(id==CHARTEVENT_OBJECT_CLICK) { if(StringFind(sparam,"Remove")>=0) { Print("Expert Removed by command !"); ExpertRemove(); return; } } }
0 means the "Remove" is found on the first position of the string. You should write:
oh, right, i forgot about that.
Thanks !
Hi guys,
Im struggling with a simple string find function.
I am using OnChartEvent handler, and my idea is to take the sparam and search it for a string, for example search for "Remove" in the object name, if there was a click on an object(button) on the chart. But the string find always returns 0 ! I printed the sparam, and its ok, it contains the word i am searching for(i have accounted for the uppercase), so this is my problem. Maybe the thing is that sparam is passed by reference, i am not sure.
Id appreciate it if someone helps !
Thanks