C#StringContains

ContainsString

EndsWith

Determines whether the string contains the specified value.

Syntax

str.Contains(value, comparisonType?)

Example

Enter values below to update the example in real time.

string
hasWorld
Contains
Console
WriteLine
string text = "Hello, World!";
bool hasWorld = text.Contains("World");
Console.WriteLine(hasWorld);   // True