LikeComparison 2.0.1
See the version list below for details.
dotnet add package LikeComparison --version 2.0.1
NuGet\Install-Package LikeComparison -Version 2.0.1
<PackageReference Include="LikeComparison" Version="2.0.1" />
<PackageVersion Include="LikeComparison" Version="2.0.1" />
<PackageReference Include="LikeComparison" />
paket add LikeComparison --version 2.0.1
#r "nuget: LikeComparison, 2.0.1"
#:package LikeComparison@2.0.1
#addin nuget:?package=LikeComparison&version=2.0.1
#tool nuget:?package=LikeComparison&version=2.0.1
LikeComparison
LikeComparison is a library that allows you to compare a string expression to a pattern in an "SQL LIKE" expression.
It supports many LIKE operator syntax:
- Visual Basic,
- Transact-SQL (with ESCAPE),
- PostgreSQL (both LIKE and ILIKE).
Main use:
Likemethod on stringsIsLikemethod on MSTest assertionsShouldBeLikemethod on Shouldly assertions
Using Like method on strings from LikeComparison package
You can simply use extension method on String class:
using LikeComparison.VisualBasic;
string? matchExpression = "abcdef";
_ = matchExpression.Like(pattern: "a*");
or
using LikeComparison.TransactSql;
string? matchExpression = "abcdef";
// common use
_ = matchExpression.Like(pattern: "a%");
// or with escape character
_ = matchExpression.Like(pattern: "/a%", escapeCharacter: "/");
or
using LikeComparison.PostgreSql;
string? matchExpression = "abcdef";
// case-insensitive
_ = matchExpression.ILike(pattern: "A%");
// or case-sensitive
_ = matchExpression.Like(pattern: "a%");
Using IsLike method on MSTest assertions from LikeComparison.MSTest package
You can simply use extension method on Assert class:
using LikeComparison.VisualBasic;
string? matchExpression = "abcdef";
Assert.That.IsLike(matchExpression, pattern: "a*");
or
using LikeComparison.TransactSql;
string? matchExpression = "abcdef";
// common use
Assert.That.IsLike(matchExpression, pattern: "a%");
// or with escape character
Assert.That.IsLike(matchExpression, pattern: "/a%", escape: "/");
or
using LikeComparison.PostgreSql;
string? matchExpression = "abcdef";
// case-insensitive
Assert.That.IsILike(matchExpression, pattern: "A%");
// or case-sensitive
Assert.That.IsLike(matchExpression, pattern: "a%");
Using ShouldBeLike method on Shouldly assertions from LikeComparison.Shouldly package
You can simply use extension method on String class:
using LikeComparison.VisualBasic;
string? matchExpression = "abcdef";
matchExpression.ShouldBeLike(pattern: "a*");
or
using LikeComparison.TransactSql;
string? matchExpression = "abcdef";
// common use
matchExpression.ShouldBeLike(pattern: "a%");
// or with escape character
matchExpression.ShouldBeLike(pattern: "/a%", escape: "/");
or
using LikeComparison.PostgreSql;
string? matchExpression = "abcdef";
// case-insensitive
matchExpression.ShouldBeILike(pattern: "A%");
// or case-sensitive
matchExpression.ShouldBeLike(pattern: "a%");
Supported syntax
Visual Basic
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/like-operator
* ? [ ] ^ #
Transact-SQL
https://docs.microsoft.com/en-us/sql/t-sql/language-elements/like-transact-sql
% _ [ ] !
PostgreSQL
https://www.postgresql.org/docs/current/functions-matching.html
% _
Supported targets
.NET Framework 4.8
- Experimental supported with C# 8.
.NET 6.0
- Recommended.
- Default target for code coverage.
.NET 7.0
- Supported.
.NET 8.0
- Supported.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Framework | net48 is compatible. net481 was computed. |
-
.NETFramework 4.8
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on LikeComparison:
| Package | Downloads |
|---|---|
|
LikeComparison.MSTest
LikeComparison is a library that allows you to compare a string expression to a pattern in an "SQL LIKE" expression. It supports many LIKE operator syntax: Visual Basic, Transact-SQL, PostgreSQL. |
|
|
LikeComparison.Shouldly
LikeComparison is a library that allows you to compare a string expression to a pattern in an "SQL LIKE" expression. It supports many LIKE operator syntax: Visual Basic, Transact-SQL, PostgreSQL. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.3.2 | 358 | 6/24/2025 |
| 2.3.1 | 393 | 3/13/2025 |
| 2.3.0 | 373 | 11/20/2024 |
| 2.2.1 | 646 | 9/19/2024 |
| 2.2.0 | 1,260 | 1/23/2024 |
| 2.1.0 | 1,036 | 10/8/2023 |
| 2.0.1 | 490 | 7/26/2023 |
| 2.0.0 | 514 | 4/4/2023 |
| 1.3.3 | 1,595 | 3/16/2023 |
| 1.3.2 | 326 | 3/2/2023 |
| 1.3.1 | 584 | 11/27/2022 |
| 1.3.0 | 449 | 11/13/2022 |
| 1.2.1 | 829 | 6/21/2022 |
| 1.2.0 | 530 | 6/21/2022 |
| 1.1.1 | 1,769 | 3/9/2022 |
| 1.1.0 | 533 | 3/8/2022 |
| 1.0.13 | 580 | 2/12/2022 |
| 1.0.12 | 568 | 1/30/2022 |
| 1.0.11 | 540 | 1/16/2022 |
| 1.0.10 | 679 | 12/27/2021 |
| 1.0.9 | 388 | 12/15/2021 |
| 1.0.8 | 389 | 12/13/2021 |
| 1.0.7 | 411 | 12/8/2021 |
| 1.0.6 | 450 | 11/10/2021 |
| 1.0.5 | 444 | 11/3/2021 |
| 1.0.4 | 541 | 10/30/2021 |
| 1.0.3 | 563 | 10/23/2021 |
| 1.0.2 | 573 | 10/23/2021 |
| 1.0.1 | 442 | 10/19/2021 |
| 1.0.0 | 1,201 | 10/2/2021 |