- If you are using MQL5 then please don't post in the MQL4 section.
- If using MQL5 then please reference the MQL5 documentation and not the MQL4 documentation (they can be very different).
- Just showing us a function implementation is not sufficient for us to determine what you are doing incorrectly.
Show a code sample that can be compiled and tested and demonstrates the issue you are experiencing.
Provide the source sample text that you are processing and not only the result.
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
- www.mql5.com
MQL5 Reference - How to use algorithmic/automated trading language for MetaTrader 5
Also, please note that the FileWrite function automatically adds a "\r\n" to the end.
If you want to write text to a file without the automatic "\r\n", then use FileWriteString.
Writes data to a file of CSV or TXT type | |
Writes the value of a string parameter into a BIN or TXT file starting from the current position of the file pointer |
Just noticed one more thing ...
StringReplace(comment,'\x10',"|"); StringReplace(comment,'\r',"|");
It should be ...
StringReplace( comment, "\xA", "|" ); // or ... StringReplace( comment, "\10", "|" ); // or ... StringReplace( comment, "\n", "|" ); StringReplace( comment, "\r", "|" ); // use " and not ' as they are string parameters and not character parameters.
You can also combine them ...
StringReplace( comment, "\r\n", "|" );
Dear Fernando,
thanks for the hints, I will respect them next time.
At the end your last comment did the trick:
StringReplace(comment,"\13","|"); //13 = CR , LF = 10
Obrigado!
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi Folks,
I have a string which I am saving to a file. Problem is, that the string has 4 CR in it, according to notepad++, which I want to replace and take out the line breaks.
I tried the following to replace the CR with e.g. pipe:
like described here: https://docs.mql4.com/basis/types/integer/symbolconstants
But nothing works. Does anybody have an idea?
P.S. I am actually using mql5
P.P.S the file is attached.
Regards
Thomas