Soenneker.Extensions.Char
4.0.102
Prefix Reserved
dotnet add package Soenneker.Extensions.Char --version 4.0.102
NuGet\Install-Package Soenneker.Extensions.Char -Version 4.0.102
<PackageReference Include="Soenneker.Extensions.Char" Version="4.0.102" />
<PackageVersion Include="Soenneker.Extensions.Char" Version="4.0.102" />
<PackageReference Include="Soenneker.Extensions.Char" />
paket add Soenneker.Extensions.Char --version 4.0.102
#r "nuget: Soenneker.Extensions.Char, 4.0.102"
#:package Soenneker.Extensions.Char@4.0.102
#addin nuget:?package=Soenneker.Extensions.Char&version=4.0.102
#tool nuget:?package=Soenneker.Extensions.Char&version=4.0.102
Soenneker.Extensions.Char
Allocation-free character classification and casing helpers with explicit ASCII-only operations and Unicode-aware fast paths.
Installation
dotnet add package Soenneker.Extensions.Char
ASCII-only operations
using Soenneker.Extensions.Char;
bool ascii = 'A'.IsAscii(); // true
bool letter = 'z'.IsAsciiLetter(); // true
bool digit = '٥'.IsAsciiDigit(); // false
bool identifierPart = '7'.IsAsciiLetterOrDigit(); // true
char upper = 'q'.ToAsciiUpper(); // 'Q'
char unchanged = 'é'.ToAsciiUpper(); // 'é'
The ASCII-only APIs never apply Unicode or culture rules:
IsAscii,IsAsciiUpper,IsAsciiLower,IsAsciiLetter,IsAsciiDigit,IsAsciiLetterOrDigitIsAsciiWhiteSpacefor space and U+0009 through U+000DToAsciiUpperandToAsciiLower, which leave non-ASCII characters unchangedEqualsAsciiIgnoreCase(c, lower), wherelowermust be a lowercase ASCII letter ('a'through'z')
EqualsAsciiIgnoreCase is intentionally specialized; it does not validate or normalize its second argument and is not a general Unicode case-insensitive comparison.
Unicode-aware operations
bool unicodeDigit = '٥'.IsDigitFast(); // true
bool unicodeLetter = '日'.IsLetterFast(); // true
bool unicodeSpace = '\u2003'.IsWhiteSpaceFast(); // true
char invariantUpper = 'é'.ToUpperInvariant(); // 'É'
IsLetterOrDigitFast, IsDigitFast, IsLetterFast, IsUpperFast, IsLowerFast, and IsWhiteSpaceFast use an ASCII branch and fall back to the matching char BCL method for non-ASCII input. Their classification semantics match those char methods; “Fast” describes the implementation path, not a narrower character set.
ToUpperInvariant and ToLowerInvariant use an ASCII branch and fall back to char.ToUpperInvariant / char.ToLowerInvariant. Like all char casing APIs, they return one UTF-16 code unit and cannot represent mappings that require multiple characters.
Separators and newlines
IsTokenSeparator() recognizes exactly:
- ASCII whitespace: tab, line feed, vertical tab, form feed, carriage return, and space
_,-,.,/,\,:, and;
All non-ASCII characters return false from IsTokenSeparator().
IsAsciiNewLine() recognizes carriage return and line feed. IsNewLineFast() additionally recognizes next line (U+0085), line separator (U+2028), and paragraph separator (U+2029). Neither method treats a CRLF pair as one unit; call it for each character while parsing.
UTF-16 boundary
A .NET char is a UTF-16 code unit, not necessarily a complete Unicode scalar value. Characters outside the Basic Multilingual Plane are represented by surrogate pairs, and these extensions see each surrogate separately. Use System.Text.Rune when classification must operate on full Unicode scalar values.
| 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
- No dependencies.
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.Extensions.Char:
| Package | Downloads |
|---|---|
|
Soenneker.Extensions.Spans.Readonly.Chars
A collection of helpful ReadOnlySpan (char) extension methods |
|
|
Soenneker.DataTables.Extensions.Types
A collection of helpful Type extension methods relating to DataTable.js |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.102 | 45,566 | 8/30/2026 |
| 4.0.101 | 422,819 | 7/28/2026 |
| 4.0.100 | 162,086 | 7/16/2026 |
| 4.0.99 | 268,064 | 6/18/2026 |
| 4.0.98 | 121,366 | 6/10/2026 |
| 4.0.97 | 103,815 | 6/5/2026 |
| 4.0.96 | 298,252 | 4/22/2026 |
| 4.0.95 | 69,763 | 4/20/2026 |
| 4.0.94 | 189,208 | 3/12/2026 |
| 4.0.93 | 134 | 3/12/2026 |
| 4.0.92 | 134 | 3/12/2026 |
| 4.0.91 | 9,720 | 3/12/2026 |
| 4.0.90 | 85,551 | 3/10/2026 |
| 4.0.89 | 48,765 | 3/9/2026 |
| 4.0.88 | 130 | 3/9/2026 |
| 4.0.87 | 128 | 3/9/2026 |
| 4.0.86 | 95,388 | 3/4/2026 |
| 4.0.85 | 152,010 | 2/20/2026 |
| 4.0.84 | 4,357 | 2/20/2026 |
| 4.0.83 | 137 | 2/20/2026 |
Fix character separator classification