"if sting in string"

cym13 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 16 05:58:43 PDT 2015


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

Turn it into either:

     if (canFind(line, term)) {...

or

     if (line.canFind(term)) {...

(they are equivalent)

This mistake seems odd, is D your first programming language?


More information about the Digitalmars-d-learn mailing list