Skip to content

String comparisons ignoring casing/whitespace #16

Description

@florian1345

There should be convenience methods to compare strings while ignoring casing and/or whitespace, such that e.g. "abc" is considered equal to "ABC" and/or " a b c ".
A potential design decision is whether each possible assertion is implemented directly on the AssertThat struct or whether there is an intermediate step to specify which aspects to ignore. In the first case, an example assertion would look like this:

assert_that!("an example string").contains_ignoring_case("example");

In the second case, the same assertion would look as follows:

assert_that!("an example string").ignoring_case().contains("example");

The first one would have the advantage of being potentially more readable and easier to implement, the latter would avoid spamming the documentation and auto-completion with similar methods.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions