On Wednesday, 16 September 2015 at 12:55:13 UTC, smadus wrote:
Hello
Searching after hours, i give up and here is the question. ;)
I will make a programm, this searching all txt files on the
system or the path from user and searching a user tiped term in
this file.
http://dpaste.dzfl.pl/dec09a0f849c
The Problem is in the if() "line 17" i searching in
std.algorithm, but i dont find a solution for my problem.
i hope, someone can help me.
I'm new on D and sorry for my bad english.
Happy Greetings
Shorty
line 17 should probably be:
if(canFind(line, term)){
you had your first closing bracket in the wrong place. Also,
canFind looks for the second argument inside the first argument.
Other notes:
There is no need to pass the arguments by ref, the data is not
copied.
File has a member function called byLine that can be used like
this:
foreach(line; actually_file.byLine())
//do something with the line
see http://dlang.org/phobos/std_stdio.html#.File.byLine
No need to chomp a line before using canFind on it.
What are you trying to write on line 18? datei isn't defined
anywhere