string concat I don't understand

2021-04-09 Thread shirleyquirk
The crucial thing to realize about the carriage return is that it affected the way your terminal _displayed_ the text, not its internal representation. Its behaviour doesn't even have anything to do with what shell you use, but which terminal emulator! For me, in a shell, if I ech

string concat I don't understand

2021-04-09 Thread FabienPRI
OK ok for splitting lines, but I though my issue was more about string concatenation. Does it mean there was a remaining c at the end of the string that made the concatenation behave that strange, replacing the string from the beginning???

string concat I don't understand

2021-04-09 Thread Hlaaftana
> I've worked a lot with text files under windows and did massive use of > split("n") That's either because old versions of Nim transformed `\n` to `\c\L` on Windows (`\p` now has this behavior), or because you previously weren't using anything that would point out the problem. I'm guessing you

string concat I don't understand

2021-04-09 Thread shirleyquirk
as others have said `splitLines` will handle windows files better than `split` as the docs say: "Every character literal newline combination (CR, LF, CR-LF) is supported. " `split` and `splitLines` have not changed since well before v1.0, i guess you just got lucky before :) to illustrate:

string concat I don't understand

2021-04-09 Thread FabienPRI
OK I will try this, but I've worked a lot with text files under windows and did massive use of split("\n") Run with Windows text files that was #13 #10 ended without any issue, but that was prior to nim 1.4

string concat I don't understand

2021-04-09 Thread FabienPRI
Yes I saw strutils.splitLines recently reading the doc, did not remember to see it before, should I have to update old code to use it, is there a reason to prefer strutils.splitLines over split, which is not clear in the doc?

string concat I don't understand

2021-04-09 Thread Araq
There is `strutils.splitLines`, especially designed for this case.

string concat I don't understand

2021-04-09 Thread PMunch
That `c` is a carriage return. You're splitting on `n` which is newline, but Windows uses `cn` for newlines in files. If you use `let contentO = readFile(my_file).split(Newlines)` it might work better (although that might split it in two.

string concat I don't understand

2021-04-09 Thread FabienPRI
Hello, I've got a text file containing 2 lines, forced to use code mode to show the exact content: \\ciosrv034\status\ 3 Run I've got the following code: let argv = commandLineParams() let contentO = readFile(my_file).split("\n") var pa