> For the complete documentation index, see [llms.txt](https://docs.shouldly.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shouldly.org/documentation/string/startwith.md).

# StartWith

## ShouldStartWith

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

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

**Exception**

```
target
    should start with
"Bart"
    but was
"Homer"
```

## ShouldNotStartWith

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

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

**Exception**

```
target
    should not start with
"Homer"
    but was
"Homer Simpson"
```
