StringKit 1.1.0
dotnet add package StringKit --version 1.1.0
NuGet\Install-Package StringKit -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="StringKit" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="StringKit" Version="1.1.0" />
<PackageReference Include="StringKit" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add StringKit --version 1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: StringKit, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package StringKit@1.1.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=StringKit&version=1.1.0
#tool nuget:?package=StringKit&version=1.1.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<p align="center"> <img src="assets/icon.svg" alt="StringKit icon" width="96" /> </p>
StringKit
FULL DOCUMENTATION: https://dennisturco.github.io/StringKit/
A lightweight .NET library of extension methods for common string transformations and formatting.
Installation
dotnet add package StringKit
Features
- Case conversion:
ToSlug,ToSnakeCase,ToCamelCase,ToPascalCase,ToTitleCase,ToSentenceCase - Truncation:
Truncate(by characters) andTruncateWords(by word count) - Normalization:
NormalizeSpaces,RemoveDiacritics,RemoveSpecialChars,NormalizeNewLines,StripHtml,CollapseWhitespace,JoinLines - Privacy / PII masking:
Redact,MaskEmail,MaskPhone - Search & comparison:
ContainsAny,ContainsAll,StartsWithAny,EndsWithAny,EqualsIgnoreCase - Validation:
IsEmail,IsUrl,IsNumeric,IsAlpha,IsAlphanumeric,IsNullOrWhiteSpace,HasMinLength,HasMaxLength - Encoding / decoding:
ToBase64,FromBase64,UrlEncode,UrlDecode,HtmlEncode,HtmlDecode - Utilities:
Repeat,Reverse - Zero external dependencies: pure .NET BCL
- All methods are static and thread-safe
Usage
using StringKit;
// Case conversion & truncation
"hello world".ToSlug() // "hello-world"
"hello world".ToCamelCase() // "helloWorld"
"hello world".ToPascalCase() // "HelloWorld"
"hello world".ToSnakeCase() // "hello_world"
"hello world".ToTitleCase(new CultureInfo("en-US")) // "Hello World"
"Hello World".Truncate(6) // "Hello..."
"ab".Repeat(3) // "ababab"
"hello".Reverse() // "olleh"
// Normalization
" ciao mondo ".NormalizeSpaces() // "ciao mondo"
"café".RemoveDiacritics() // "cafe"
"Hello! @#$%".RemoveSpecialChars() // "Hello"
"<p>Hello <b>World</b></p>".StripHtml() // "Hello World"
// Privacy / PII masking
"mario@mail.it".MaskEmail() // "m****@mail.it"
"3331234567".MaskPhone() // "333*****67"
// Search & comparison
"Hello World".ContainsAny("World", "Foo") // true
"Hello".EqualsIgnoreCase("hello") // true
// Validation
"mario@mail.it".IsEmail() // true
"12345".IsNumeric() // true
"Hello".HasMinLength(3) // true
// Encoding / decoding
"Hello".ToBase64() // "SGVsbG8="
"hello world".UrlEncode() // "hello+world"
"<b>Hi</b>".HtmlEncode() // "<b>Hi</b>"
Contributing
Contributions are welcome! Please open an issue or pull request on GitHub.
See CONTRIBUTING.md for guidelines.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.