iStringExtensions 1.1.0
dotnet add package iStringExtensions --version 1.1.0
NuGet\Install-Package iStringExtensions -Version 1.1.0
<PackageReference Include="iStringExtensions" Version="1.1.0" />
<PackageVersion Include="iStringExtensions" Version="1.1.0" />
<PackageReference Include="iStringExtensions" />
paket add iStringExtensions --version 1.1.0
#r "nuget: iStringExtensions, 1.1.0"
#:package iStringExtensions@1.1.0
#addin nuget:?package=iStringExtensions&version=1.1.0
#tool nuget:?package=iStringExtensions&version=1.1.0
iStringExtensions
A C# library that provides a collection of useful string extension methods for common string manipulation and validation tasks. This library consolidates various string utility methods used across different projects into a single, reusable package.
Installation
You can install iStringExtensions via NuGet:
Install-Package iStringExtensions
Or using the .NET CLI:
dotnet add package iStringExtensions
Features
String Validation
IsInteger()
: Check if a string represents a valid integerIsNumber()
: Check if a string represents a valid number (supports decimal numbers)IsJson()
: Validate if a string is valid JSONIsEmail()
: Validate email address formatIsIpV4()
: Validate IPv4 address format
String Transformation
WrapWithAList()
: Convert string to List<string>WrapWithAnArray()
: Convert string to string arrayConsolidateSpaces()
: Replace multiple consecutive spaces with a single spaceToMemoryStream()
: Convert string to MemoryStream
String Parsing
SplitAsEnumerableOf<T>()
: Split string into enumerable of any primitive typeQueryStringToDictionary()
: Parse query string into dictionaryRegexMatch()
: Perform regex matchingRegexExtract()
: Extract matches using regex
String Hashing
GetMd5Hash()
: Generate MD5 hash of a stringGetSha1Hash()
: Generate SHA1 hash of a string
JSON Handling
DeserializeJson<T>()
: Deserialize JSON strings into objects
Usage Examples
using iStringExtensions;
// Validation examples
bool isInteger = "123".IsInteger(); // true
bool isNumber = "123.45".IsNumber(); // true
bool isValidJson = "{\"name\":\"test\"}".IsJson(); // true
// Transformation examples
List<string> list = "test".WrapWithAList();
string[] array = "test".WrapWithAnArray();
// Parsing examples
var numbers = "1,2,3".SplitAsEnumerableOf<int>(",");
var dictionary = "key1=value1;key2=value2".QueryStringToDictionary();
// Hashing examples
string md5 = "test".GetMd5Hash();
string sha1 = "test".GetSha1Hash();
Error Handling
The library includes robust error handling with a custom StringExtensionsException
class that is thrown when validation fails or invalid operations are attempted.
Testing
The library includes comprehensive unit tests in the UnitTests
project using xUnit and FluentAssertions.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net6.0
- Fastenshtein (>= 1.0.0.8)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.