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
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???
> 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
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:
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
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?
There is `strutils.splitLines`, especially designed for this case.
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.
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