Soenneker.Utils.String
4.0.3171
Prefix Reserved
dotnet add package Soenneker.Utils.String --version 4.0.3171
NuGet\Install-Package Soenneker.Utils.String -Version 4.0.3171
<PackageReference Include="Soenneker.Utils.String" Version="4.0.3171" />
<PackageVersion Include="Soenneker.Utils.String" Version="4.0.3171" />
<PackageReference Include="Soenneker.Utils.String" />
paket add Soenneker.Utils.String --version 4.0.3171
#r "nuget: Soenneker.Utils.String, 4.0.3171"
#:package Soenneker.Utils.String@4.0.3171
#addin nuget:?package=Soenneker.Utils.String&version=4.0.3171
#tool nuget:?package=Soenneker.Utils.String&version=4.0.3171
Soenneker.Utils.String
String helpers for query strings, lightweight model binding, URL extraction, templates, compound identifiers, and Base64-encoded JSON.
Installation
dotnet add package Soenneker.Utils.String
Most helpers are static and can be called directly:
using Soenneker.Utils.String;
string id = StringUtil.ToCombinedId("customer", "42");
string? returnUrl = StringUtil.GetQueryParameter(
"https://example.test/callback?returnUrl=%2Faccount%3Ftab%3Dsecurity",
"returnUrl");
ToCombinedId removes null and empty parts and joins the rest with :. It does not escape delimiters, so do not use it where parts containing : must remain distinguishable.
Query strings
GetQueryParameter returns the first matching value from any string containing a ?. Names and values use form-style decoding, where percent escapes are decoded and + becomes a space. A key without = has an empty value, matching is case-sensitive, and URL fragments are excluded.
GetQueryParameters accepts an absolute URI and returns an ordinal, case-sensitive dictionary. The first occurrence of a duplicate decoded key wins. It returns null when the input is not an absolute URI or has no query parameters.
Dictionary<string, string>? values = StringUtil.GetQueryParameters(
"https://example.test/search?q=red+shoes&page=2");
// values["q"] == "red shoes"
Binding query strings
Register IStringUtil when you need the reflection-based binder or email-domain extraction through dependency injection:
using Soenneker.Utils.String.Abstract;
using Soenneker.Utils.String.Registrars;
services.AddStringUtilAsSingleton();
public sealed class SearchService(IStringUtil strings)
{
public SearchRequest Parse(string query) => strings.ParseQueryString<SearchRequest>(query);
}
ParseQueryString<T> creates T, matches query keys to public writable properties without regard to case, and converts values with Convert.ChangeType. Unknown keys are ignored. It is intended for simple scalar properties; failed conversions throw, and nullable, collection, or complex properties require a different binding strategy.
ParseQueryStringUsingJson<T> is the tolerant static alternative. It builds a string-valued dictionary and deserializes it through Soenneker.Utils.Json; conversion failures return null and are written to the optional logger.
Other helpers
GetDomainFromEmailreturns the text after the last@when both sides are non-empty. It does not validate an email address.ExtractUrlsfinds URL-shaped substrings. Treat the results as candidates, not validated or trusted destinations.BuildStringFromTemplatereplaces brace-delimited placeholders sequentially with non-null values. Placeholder names are informational; unmatched placeholders remain in the result, and braces are not escaped.ConvertBase64JsonToObject<T>decodes standard Base64 containing UTF-8 JSON. Invalid Base64 or JSON throws. It does not accept the Base64Url alphabet.
ConvertBase64JsonToObject<T> clears the portion of its pooled decode buffer before returning it, but decoded objects and input strings remain managed memory. Do not treat it as a complete secret-erasure mechanism.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Soenneker.Extensions.Enumerable (>= 4.0.658)
- Soenneker.Extensions.NameValueCollection (>= 4.0.834)
- Soenneker.Reflection.Cache (>= 4.0.673)
- Soenneker.Utils.Json (>= 4.0.2669)
- Soenneker.Utils.RegexCollection (>= 4.0.94)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Soenneker.Utils.String:
| Package | Downloads |
|---|---|
|
Soenneker.Validators.Email.Disposable.Online
A validation module checking for disposable email addresses via online sources |
|
|
Soenneker.Validators.Email.Disposable
Checks whether an email address uses a disposable or temporary domain. |
|
|
Soenneker.Validators.Email.Mx
A validation module checking for the existence of domain MX records |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.3171 | 0 | 9/1/2026 |
| 4.0.3170 | 0 | 9/1/2026 |
| 4.0.3169 | 0 | 9/1/2026 |
| 4.0.3168 | 0 | 8/31/2026 |
| 4.0.3166 | 0 | 8/31/2026 |
| 4.0.3165 | 20 | 8/31/2026 |
| 4.0.3164 | 35 | 8/31/2026 |
| 4.0.3163 | 41 | 8/31/2026 |
| 4.0.3162 | 71 | 8/31/2026 |
| 4.0.3161 | 30 | 8/31/2026 |
| 4.0.3160 | 43 | 8/31/2026 |
| 4.0.3158 | 68 | 8/31/2026 |
| 4.0.3156 | 43 | 8/31/2026 |
| 4.0.3155 | 72 | 8/30/2026 |
| 4.0.3154 | 53 | 8/30/2026 |
| 4.0.3152 | 118 | 8/30/2026 |
| 4.0.3150 | 40 | 8/30/2026 |
| 4.0.3148 | 84 | 8/30/2026 |
| 4.0.3146 | 44 | 8/30/2026 |
| 4.0.3144 | 43 | 8/30/2026 |
Updated NuGet packages
- [Soenneker.Reflection.Cache](Soenneker.Reflection.Cache): [4.0.672](Soenneker.Reflection.Cache/4.0.672) -> [4.0.673](Soenneker.Reflection.Cache/4.0.673)
- [Soenneker.Tests.HostedUnit](Soenneker.Tests.HostedUnit): [4.0.223](Soenneker.Tests.HostedUnit/4.0.223) -> [4.0.225](Soenneker.Tests.HostedUnit/4.0.225)