On Tuesday, 18 June 2019 at 09:42:41 UTC, aliak wrote:
On Tuesday, 18 June 2019 at 01:15:54 UTC, Samir wrote:
On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote:
That's because you're using write*ln*. So even though line is
empty, you still output a new line.
Curious. I am going to have to
On Tuesday, 18 June 2019 at 01:15:54 UTC, Samir wrote:
On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote:
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
Any suggestions on how to rectify?
You could change the IF to
`if(line.length > 0 && line[0] == '>')`
Thanks, Norm. That
On Monday, 17 June 2019 at 03:46:11 UTC, Norm wrote:
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
Any suggestions on how to rectify?
You could change the IF to
`if(line.length > 0 && line[0] == '>')`
Thanks, Norm. That seemed to do the trick and fixed the error.
On Monday, 17
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
Also, if I run the program below with the same file, I don't
get any range violation errors:
Ya, writeln will not access individual elements of a range if
there aren't any. So no violations occur.
HOWEVER, the output is interesting.
On Monday, 17 June 2019 at 00:22:23 UTC, Samir wrote:
On Sunday, 16 June 2019 at 23:55:41 UTC, lithium iodate wrote:
There is *very* likely to be a terminating new-line at the end
of the file (many editors add one without asking!). If that
the case, the last line seen by the loop will be empty
On Sunday, 16 June 2019 at 23:55:41 UTC, lithium iodate wrote:
There is *very* likely to be a terminating new-line at the end
of the file (many editors add one without asking!). If that the
case, the last line seen by the loop will be empty and you must
not attempt to access any elements.
On
On Sunday, 16 June 2019 at 23:44:49 UTC, Samir wrote:
On Sunday, 16 June 2019 at 23:03:04 UTC, aliak wrote:
stripping the last line could result in an empty line if it
just has strippable characters?
The last line of the file is just text but without a newline
(\n) character or any other
On Sunday, 16 June 2019 at 23:44:49 UTC, Samir wrote:
On Sunday, 16 June 2019 at 23:03:04 UTC, aliak wrote:
stripping the last line could result in an empty line if it
just has strippable characters?
The last line of the file is just text but without a newline
(\n) character or any other
On Sunday, 16 June 2019 at 23:03:04 UTC, aliak wrote:
stripping the last line could result in an empty line if it
just has strippable characters?
The last line of the file is just text but without a newline (\n)
character or any other whitespace character at the end. I get
the same error
On Sunday, 16 June 2019 at 23:03:04 UTC, aliak wrote:
stripping the last line could result in an empty line if it
just has strippable characters?
The last line is just the text of the last line. There is no
newline character at the end. I also get the same error if I
remove the strip
On Sunday, 16 June 2019 at 22:47:14 UTC, Samir wrote:
I am trying to read from a text file using the following code:
import std.stdio;
import std.string;
void main() {
File file = File("test.txt");
string line;
while (!file.eof()) {
line = strip(file.readln());
if
11 matches
Mail list logo