StringReplace() deprecated?? [warning 91: deprecated behavior, hidden method calling will be disabled in a future MQL compiler version]
Do you really expect an answer? We can't see your broken code — we can only guess. There are no mind readers here and our crystal balls are cracked.
Just Import this telgram lib with it's dependencies to your \include folder (I attached here all the files) to any project of yours and try to compile it. Voylla! There you are, Warning 91 to all the StringReplace() functions.
Documentation |
Telegram.mqh |
---|---|
int StringReplace( string& str, // the string in which substrings will be replaced const string find, // the searched substring const string replacement // the substring that will be inserted to the found positions ); |
StringReplace( text, pos, 6, ShortToString((ushort)dec) ); |
The current compiler build 2170 of Metatrader 5 is acusing All my StringReplace() on MQ5 code as deprecated.
warning 91: deprecated behavior, hidden method calling will be disabled in a future MQL compiler version
What to do?!! What is the replacement to this function? Any ways to solve it?
mql5 StringReplace() function is not deprecated. What is deprecated is "hidden" method calling.
In your lib StringReplace() is overloaded and that's the problem.
Add the global scope operator before each call the mql5 StringReplace occurence and the warnings are gone.
::StringReplace(text,";"," ");
mql5 StringReplace() function is not deprecated. What is deprecated is "hidden" method calling.
In your lib StringReplace() is overloaded and that's the problem.
Add the global scope operator before each call the mql5 StringReplace occurence and the warnings are gone.
Thanks man. This info helped. It is only working answer I've found in seven days.
Hello:
The same thing happens to me and adding what they comment disappear the warnings ... but I don't quite understand what "::" is and how in the future they will replace this function ...
Thanks, as always!
Hello:
The same thing happens to me and adding what they comment disappear the warnings ... but I don't quite understand what "::" is and how in the future they will replace this function ...
Thanks, as always!
I had the same problem with another library, where there were classes that inherited functions without parameters, but added new parameters to them
Now, you have to clarify which version of the function you are calling (even though they have a different amount of parameters, but that seems will be deprecated "soon")
//3 parameters: use the standard definition of StringReplace (Global scope) StringReplace(text,"\n",ShortToString(0x0A)); /* ---> */ ::StringReplace(text,"\n",ShortToString(0x0A)); //4 parameters: use the function that is defined in THIS class (Local scope) StringReplace(text,pos,6,ShortToString((ushort)result)); /* ---> */ CCustomBot::StringReplace(text,pos,6,ShortToString((ushort)result));

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
The current compiler build 2170 of Metatrader 5 is acusing All my StringReplace() on MQ5 code as deprecated.
warning 91: deprecated behavior, hidden method calling will be disabled in a future MQL compiler version
What to do?!! What is the replacement to this function? Any ways to solve it?