"if sting in string"

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 16 05:58:42 PDT 2015


On 17/09/15 12:55 AM, 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

Highly inefficient design in code, but lets ignore that.

You want std.string : indexOf.

if (line.indexOf(term) >= 0) {

If I remember correctly.



More information about the Digitalmars-d-learn mailing list