Soenneker.Utils.String
4.0.3155
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Utils.String --version 4.0.3155
NuGet\Install-Package Soenneker.Utils.String -Version 4.0.3155
<PackageReference Include="Soenneker.Utils.String" Version="4.0.3155" />
<PackageVersion Include="Soenneker.Utils.String" Version="4.0.3155" />
<PackageReference Include="Soenneker.Utils.String" />
paket add Soenneker.Utils.String --version 4.0.3155
#r "nuget: Soenneker.Utils.String, 4.0.3155"
#:package Soenneker.Utils.String@4.0.3155
#addin nuget:?package=Soenneker.Utils.String&version=4.0.3155
#tool nuget:?package=Soenneker.Utils.String&version=4.0.3155
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.657)
- Soenneker.Extensions.NameValueCollection (>= 4.0.830)
- Soenneker.Reflection.Cache (>= 4.0.666)
- Soenneker.Utils.Json (>= 4.0.2657)
- Soenneker.Utils.RegexCollection (>= 4.0.93)
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.3165 | 0 | 8/31/2026 |
| 4.0.3164 | 0 | 8/31/2026 |
| 4.0.3163 | 0 | 8/31/2026 |
| 4.0.3162 | 0 | 8/31/2026 |
| 4.0.3161 | 0 | 8/31/2026 |
| 4.0.3160 | 34 | 8/31/2026 |
| 4.0.3158 | 48 | 8/31/2026 |
| 4.0.3156 | 36 | 8/31/2026 |
| 4.0.3155 | 56 | 8/30/2026 |
| 4.0.3154 | 49 | 8/30/2026 |
| 4.0.3152 | 103 | 8/30/2026 |
| 4.0.3150 | 38 | 8/30/2026 |
| 4.0.3148 | 77 | 8/30/2026 |
| 4.0.3146 | 43 | 8/30/2026 |
| 4.0.3144 | 42 | 8/30/2026 |
| 4.0.3142 | 55 | 8/30/2026 |
| 4.0.3141 | 112 | 8/29/2026 |
| 4.0.3139 | 37 | 8/29/2026 |
| 4.0.3138 | 102 | 8/29/2026 |
| 4.0.3137 | 119 | 8/27/2026 |
Improve string utility documentation and query handling