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: > Even this one could works: > > import std.stdio; > > void main(string[] args) > { > auto range = File("text.txt").byLine(); > > foreach (line; range) > > { > if (line != "") > { > writeln(line); > range.popFront; > char[] url = range.front().dup; > range.popFront; > char[] num = range.front().dup > } > } > } > 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 od trim but it is not more elegant. Maybe open enhancement on issues.dlang.org to phobos to add parametr for not keeping line end char unrelated second question: Why is there no split function with a maxsplit parameter? what is maxsplit parametr, I have never use it od need it?