mardi 31 mars 2015

How to find a sentence spread over mutltiple lines in a multiline string

As the title says. I have this string read from a file into a string



"has anyone really been far even as decided to
use even go want
to do look more like"


When I do this, it writes hello world.



if (string.Contains(@"use even go want
to do look more like"))
{
Console.Write("Hello world!");
}


but when I do this, it won't work.



if (string.Contains(@"use even go want\nto do look more like"))
{
Console.Write("Hello world!");
}


Isn't there a better way to find a sentence spread over multiple lines in a string instead of just planting a return in the middle of the code?


(I've also already tried \n\r, \r\n and \r)


Aucun commentaire:

Enregistrer un commentaire