Shouldly
  • Overview
  • Contributing
  • Documentation
    • Getting Started
    • Configuration
    • Equality
      • ShouldBe
      • NotBe
      • Null
      • Bool
      • Flags
      • AssignableTo
      • OfType
      • OneOf
      • Greater/Less Than
      • InRange
      • MatchApproved
      • Enumerable
      • SameAs
      • String
      • ExampleClasses
    • String
      • ShouldBe
      • Match
      • Contain
      • Null and Empty
      • StartWith
      • EndWith
    • Enumerable
      • ShouldBe
      • All
      • Empty
      • OneOf
      • Contain
      • Unique
      • SubsetOf
      • Have
    • Dictionary
      • ContainKey
      • ContainKeyAndValue
    • Exceptions
      • Throw
      • NotThrow
    • SatisfyAllConditions
    • CompleteIn
    • DynamicShould
    • Upgrade 3 to 4
Powered by GitBook
On this page
  • ShouldStartWith
  • ShouldNotStartWith
Edit on GitHub
  1. Documentation
  2. String

StartWith

PreviousNull and EmptyNextEndWith

Last updated 2 years ago

ShouldStartWith

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

|

Exception

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

ShouldNotStartWith

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

|

Exception

target
    should not start with
"Homer"
    but was
"Homer Simpson"
snippet source
snippet source
anchor
anchor