Stringfunction and NewLine

To add comments, please log in or register
sunshineh
1259
sunshineh  

Hi,

I read my txt-File into and buffer (with the kernel32.dll like here https://www.mql5.com/en/articles/1540) .

Now I extract to word "tuesday" as the first word in the second line:

               Str = StringSubstr(buffer_read,pos_start,pos_end-pos_start);
               pos_start = pos_end+1;
               StringTrimLeft(Str);
               StringTrimRight(Str);
               Print("Str: ",Str);
               if (Str == "tuesday")
                  {...
                   }

on the Print-function I see that Str = tuesday, but the if-loop isn't true!

When I wrote everything in ONE line, it works.

So, how could I delete the new line before "tuesday" (even if I can't see it)?

bernd
989
bernd  
  1. StringTrimLeft() and StringTrimRight() don't change the string, they return a new (trimmed) string instead. You should read the documention of the functions you use. How can you call a function if you didn't even have only one single look at its documentation? Its always only one keystroke (F1) away from you!
  2. There is no such thing as an "if loop", a loop is a loop and an if is not a loop.
To add comments, please log in or register