# Contain

## ShouldContain

```cs
var target = "Homer";
target.ShouldContain("Bart");
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/StringExamples.ShouldContain.codeSample.approved.cs#L1-L2) | [anchor](#snippet-StringExamples.ShouldContain.codeSample.approved.cs)

**Exception**

```
target
    should contain (case insensitive comparison)
"Bart"
    but was actually
"Homer"
```

## ShouldContainWithoutWhitespace

```cs
var target = "Homer Simpson";
target.ShouldContainWithoutWhitespace(" Bart Simpson ");
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/StringExamples.ShouldContainWithoutWhitespace.codeSample.approved.cs#L1-L2) | [anchor](#snippet-StringExamples.ShouldContainWithoutWhitespace.codeSample.approved.cs)

**Exception**

```
target
    should contain without whitespace
" Bart Simpson "
    but was actually
"Homer Simpson"
```

## ShouldNotContain

```cs
var target = "Homer";
target.ShouldNotContain("Home");
```

[snippet source](https://github.com/shouldly/shouldly/blob/master/src/DocumentationExamples/CodeExamples/StringExamples.ShouldNotContain.codeSample.approved.cs#L1-L2) | [anchor](#snippet-StringExamples.ShouldNotContain.codeSample.approved.cs)

**Exception**

```
target
    should not contain (case insensitive comparison)
"Home"
    but was actually
"Homer"
```
