<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">Dne 2. 2. 2017 20:35 napsal uživatel "John Doe via Digitalmars-d-learn" <<a href="mailto:digitalmars-d-learn@puremagic.com">digitalmars-d-learn@puremagic.com</a>>:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On Thursday, 2 February 2017 at 18:58:46 UTC, Daniel Kozak wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">
Even this one could works:<br>
<br></div><div class="quoted-text">
import std.stdio;<br>
<br>
void main(string[] args)<br>
{<br>
  Â  auto range = File("text.txt").byLine();<br>
<br></div><div class="quoted-text">
  Â  foreach (line; range)<br>
<br>
  Â  {<br>
  Â  Â  Â  if (line != "")<br>
  Â  Â  Â  {<br>
  Â  Â  Â  Â  Â  writeln(line);<br>
  Â  Â  Â  Â  Â  range.popFront;<br></div><div class="quoted-text">
  Â  Â  Â  Â  Â  char[] url = range.front().dup;<br>
  Â  Â  Â  Â  Â  range.popFront;<br>
  Â  Â  Â  Â  Â  char[] num = range.front().dup<br>
  Â  Â  Â  }<br>
  Â  }<br>
}<br>
</div></blockquote>
<br>
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?<br></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">you can use popBack on readln od trim but it is not more elegant. Maybe open enhancement on <a href="http://issues.dlang.org">issues.dlang.org</a> to phobos to add parametr for not keeping line end char</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
unrelated second question: Why is there no split function with a maxsplit parameter?<br>
</blockquote></div><br></div><div class="gmail_extra" dir="auto">what is maxsplit parametr, I have never use it od need it?</div></div></div>