Hi,
I'm porting my mq4 program to mq5 and I face compilation issues, not sure what variable expected here as I'm already passing str variable for StringSubst.
const string str=NewsArr[0][nomf];
string time=StringConcatenate(StringSubstr (str,0,4),".",StringSubstr(str,5,2),".",StringSubstr(str,8,2)," ",StringSubstr(str,11,2),":",StringSubstr(str,14,4));
Error:
'StringSubstr' - variable expected
Pls help
It does not work when you use it within the StringConcatenate() function
Use it like this instead
It does not work when you use it within the StringConcatenate() function
Use it like this instead
Yes it works with StringConcatenate(), but the mql5 version of this function is not the same as mql4.
StringConcatenate(time,StringSubstr (str,0,4),".",StringSubstr(str,5,2),".",StringSubstr(str,8,2)," ",StringSubstr(str,11,2),":",StringSubstr(str,14,4));
Yes it works with StringConcatenate(), but the mql5 version of this function is not the same as mql4.
StringConcatenate(time,StringSubstr (str,0,4),".",StringSubstr(str,5,2),".",StringSubstr(str,8,2)," ",StringSubstr(str,11,2),":",StringSubstr(str,14,4));
Yep. My bad ;(
Thanks :)
Awesome!!!
Thanks Mladen Rakic It worked
Yes, but read this post too :
Yes it works with StringConcatenate(), but the mql5 version of this function is not the same as mql4.
StringConcatenate(time,StringSubstr (str,0,4),".",StringSubstr(str,5,2),".",StringSubstr(str,8,2)," ",StringSubstr(str,11,2),":",StringSubstr(str,14,4));
So it works within string concatenate too (if the first parameter is not omitted and is properly declared as variable)
It depends what form do you like more. I don't like StringConcatenate() (which is obvious:)) and I prefer using the + form (less code and simpler to follow) - but that depends on the style I guess

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I'm porting my mq4 program to mq5 and I face compilation issues, not sure what variable expected here as I'm already passing str variable for StringSubst.
const string str=NewsArr[0][nomf];
string time=StringConcatenate(StringSubstr (str,0,4),".",StringSubstr(str,5,2),".",StringSubstr(str,8,2)," ",StringSubstr(str,11,2),":",StringSubstr(str,14,4));
Error:
'StringSubstr' - variable expected
Pls help