Oakrey.Strings
2.3.0
dotnet add package Oakrey.Strings --version 2.3.0
NuGet\Install-Package Oakrey.Strings -Version 2.3.0
<PackageReference Include="Oakrey.Strings" Version="2.3.0" />
<PackageVersion Include="Oakrey.Strings" Version="2.3.0" />
<PackageReference Include="Oakrey.Strings" />
paket add Oakrey.Strings --version 2.3.0
#r "nuget: Oakrey.Strings, 2.3.0"
#:package Oakrey.Strings@2.3.0
#addin nuget:?package=Oakrey.Strings&version=2.3.0
#tool nuget:?package=Oakrey.Strings&version=2.3.0
Oakrey.Strings
Utilities for string parsing, numeral-system conversion, binary/hex encoding, text/code naming helpers and small string guard exceptions.
Installation
dotnet add package Oakrey.Strings
Package Manager Console:
Install-Package Oakrey.Strings
Binary And Hex
byte[] bytes = "0b1010_0101".FromBinaryStringToByteArray();
string binary = bytes.ToBinaryString(" ");
byte[] hexBytes = "0xA5-FF".FromHexadecimalStringToByteArray();
string hex = hexBytes.ToHexadecimalString(" ");
For user input, prefer the non-throwing helpers:
if (input.TryFromHexadecimalStringToByteArray(out byte[] parsed))
{
// use parsed bytes
}
Numeric Parsing
The package supports binary, decimal and hexadecimal parsing for common numeric types.
int value = IntParser.Parse("0xFF", NumericParserOption.Hexadecimal);
bool parsed = NumericParser.NumericTryParse<byte>("0b1010", NumericParserOption.Binary, [ByteParser.TryBin], out byte byteValue);
Multiple-numeral-system helpers parse lists with configurable separators and ignore empty parts between repeated separators.
int[] values = "1,, 2;;;0x03".ParseInts([',', ';']);
Text Helpers
string pascal = "hello world".FromTextToPascalCase();
string camel = "hello world".FromTextToCamelCase();
string snake = "Hello World".FromTextToSnakeCase();
string kebab = "Hello World".FromTextToKebabCase();
string slug = "Příliš žluťoučký kůň".FromTextToSlug();
FromTextToSlug removes diacritics and lower-cases words using invariant culture.
Code-to-text helpers convert common identifier shapes back to readable text:
string text = "HttpServerError".FromPascalAndCamelCaseToText();
string name = "hello-world".FromKebabCaseToText();
The older FromKebebCaseToText spelling remains available for compatibility.
StringBuilder And Guards
StringBuilder builder = new();
builder.AppendLines(["first", "second"]);
value.ThrowIfEmpty(nameof(value));
value.ThrowIfWhiteSpace(nameof(value));
Safety Notes
- Binary and hexadecimal converters validate allowed characters before conversion and expose non-throwing variants.
- Numeric try-parse helpers catch expected parse failures and return
falseinstead of leaking conversion exceptions. - Text casing uses invariant culture where casing is part of formatting behavior.
- StringBuilder extension methods validate null receivers and arguments explicitly.
Project Information
- Author: Oakrey
- Company: Oakrey (Website)
- License: MIT
- Repository: Common
- NuGet: Oakrey.Strings
| 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 (3)
Showing the top 3 NuGet packages that depend on Oakrey.Strings:
| Package | Downloads |
|---|---|
|
Oakrey.Xml
Provides a framework for working with XML in .NET applications, including parsing extensions, validation, XSD support, serialization, and LINQ to XML enhancements. Simplifies XML data manipulation and validation |
|
|
Oakrey.Applications.Reporting
A .NET 10 library for structured, lifecycle-driven reporting. Defines IReporter and IReportConsumer generics with a TStatus enum, supporting report/block/item lifecycle events, evidence attachment, key-value metadata, and file output via FileReporter. RunnableReporter fans out to multiple consumers simultaneously. |
|
|
Oakrey.ASRockMotherboard
Managed wrapper for the ASRock IMB-1222 motherboard native SDK (AsrCore.dll, Windows only). Provides IAsrMotherboard for GPIO pin control (pins 71-77, 80; input/output/state), and hardware telemetry reads: CPU core and package temperature, DC-in voltage, core count, and board serial number. |
GitHub repositories
This package is not used by any popular GitHub repositories.