On Thursday, 2 February 2017 at 20:26:36 UTC, Daniel Kozak wrote:
Dne 2. 2. 2017 20:35 napsal uživatel "John Doe via
Digitalmars-d-learn" < digitalmars-d-learn@puremagic.com>:
On Thursday, 2 February 2017 at 18:58:46 UTC, Daniel Kozak
wrote:
[...]
Thanks readln is perfect. Since I am calling readln in
different places and I always need to remove the newline
character I have line=line[0..$-1] all over my code. Is there
are better way?
you can use popBack on readln or trim but it is not more
elegant. Maybe open enhancement on issues.dlang.org to phobos
to add parameter for not keeping line end char
unrelated second question: Why is there no split function with
a maxsplit parameter?
what is maxsplit parameter, I have never use it or need it?
Python's split function has an optional maxsplit parameter to
specify the maximum splits that should be done. So that
"1,2,3,4,5".split(',', 3) returns ['1', '2', '3', '4,5'].