CaseON 1.4.0
dotnet add package CaseON --version 1.4.0
NuGet\Install-Package CaseON -Version 1.4.0
<PackageReference Include="CaseON" Version="1.4.0" />
paket add CaseON --version 1.4.0
#r "nuget: CaseON, 1.4.0"
// Install CaseON as a Cake Addin #addin nuget:?package=CaseON&version=1.4.0 // Install CaseON as a Cake Tool #tool nuget:?package=CaseON&version=1.4.0
CaseON: A Comprehensive C# String Manipulation and Validation Library
CaseON is a lightweight and efficient C# library designed to simplify string manipulation and validation. It provides robust utilities for converting strings to various casing styles, validating common data formats, and, with the addition of the MatchON
namespace, enables advanced string similarity comparisons.
Features
String Casing Styles:
Convert strings into the following popular casing formats:
snake_case
kebab-case
PascalCase
camelCase
Sentence case
Title Case
String Validation Methods:
Extensive helper methods to validate common string formats:
- Email Validation: Validates if the string is a valid email address.
- URL Validation: Validates if the string is a properly formatted URL.
- IP Address Validation (IPv4 & IPv6): Validates if the string matches the format for valid IPv4 and IPv6 addresses.
- Alphanumeric, Numeric, Alphabetic Validation: Verifies if the string contains only alphanumeric, numeric, or alphabetic characters.
- Phone Number Validation: Ensures the string matches the format of a valid phone number.
- GUID, File Path, and Hex Color Validation: Validates GUIDs, file paths, and hex color codes.
- Base64 String Validation: Validates if the string is a valid Base64 encoded string.
- Credit Card, Routing Number, and CVV Validation: Validates credit card numbers, bank routing numbers, and CVVs using standard algorithms.
- IBAN, ISBN, and Social Security Number (SSN) Validation: Validates international banking account numbers, ISBNs, and US SSNs.
- Date, Postal Code, and Address Validation: Verifies if the string is a valid date, postal code (supports multiple countries), or physical address.
- JSON and XML Validation: Validates if the string is in proper JSON or XML format.
Advanced String Similarity Matching:
With the new MatchON
namespace, CaseON adds several advanced string similarity algorithms:
- Levenshtein Distance: Measures the minimum number of single-character edits required to transform one string into another.
- Jaro-Winkler Similarity: Computes the similarity between two strings, focusing on the number of common characters and their order.
- Longest Common Subsequence (LCS): Measures similarity based on the longest subsequence present in both strings.
Robust Input Handling:
- Throws informative
ArgumentException
s for null or empty/whitespace input strings. - Handles strings containing spaces, underscores, hyphens, and various separators.
- Ensures that common data formats are properly validated before usage.
Easy to Use:
- Simple static methods provide a clean and intuitive API.
- Built-in validation methods for common use cases make it easy to ensure input correctness.
Lightweight:
- Minimal dependencies, easy to integrate into existing projects.
- The library can be used for both string casing conversions and data format validation.
Version 1.4.0.0 Changelog
New Features:
New
MatchON
Namespace:- Introduced a new namespace
MatchON
that includes advanced string similarity matching algorithms to compare strings with greater accuracy. The following methods are now available:- Levenshtein Distance: Measures the number of edits required to transform one string into another, with a normalized similarity score returned between 0 and 1.
- Jaro-Winkler Similarity: Computes the similarity based on the number of common characters and their relative order, returning a score adjusted for prefixes.
- Longest Common Subsequence (LCS): Computes the longest subsequence common to both strings and provides a similarity score based on the LCS length.
- Introduced a new namespace
String Validation Methods:
- Enhanced the string validation capabilities with 15+ new validation methods for various formats including email, URL, IP addresses, phone numbers, and more.
Bug Fixes & Improvements:
- Fixed minor bugs related to input handling for edge cases in validation methods.
- Improved the performance of string casing conversion methods for longer strings.
Usage
Installation: You can easily add CaseON to your project via NuGet. Alternatively, you can directly include the source code in your project.
Basic Example:
using CaseON;
// String Casing
string myString = "This Is A Test String";
string snakeCase = CaseON.ConvertON.ToSnakeCase(myString); // Output: this_is_a_test_string
string kebabCase = CaseON.ConvertON.ToKebabCase(myString); // Output: this-is-a-test-string
string pascalCase = CaseON.ConvertON.ToPascalCase(myString); // Output: ThisIsATestString
string camelCase = CaseON.ConvertON.ToCamelCase(myString); // Output: thisIsATestString
string sentenceCase = CaseON.ConvertON.ToSentenceCase(myString); // Output: This is a test string
string titleCase = CaseON.ConvertON.ToTitleCase(myString); // Output: This Is A Test String
Console.WriteLine($"Snake Case: {snakeCase}");
Console.WriteLine($"Kebab Case: {kebabCase}");
Console.WriteLine($"Pascal Case: {pascalCase}");
Console.WriteLine($"Camel Case: {camelCase}");
Console.WriteLine($"Sentence Case: {sentenceCase}");
Console.WriteLine($"Title Case: {titleCase}");
string email = "test@example.com";
string url = "https://www.example.com";
string ipAddress = "192.168.1.1";
string phoneNumber = "+1234567890";
string postalCode = "90210";
string date = "2024-11-26";
bool isValidEmail = CaseON.ValidateON.IsValidEmail(email); // Output: true
bool isValidUrl = CaseON.ValidateON.IsValidUrl(url); // Output: true
bool isValidIp = CaseON.ValidateON.IsValidIPv4(ipAddress); // Output: true
bool isValidPhone = CaseON.ValidateON.IsValidPhoneNumber(phoneNumber); // Output: true
bool isValidPostal = CaseON.ValidateON.IsValidPostalCode(postalCode); // Output: true
bool isValidDate = CaseON.ValidateON.IsValidDate(date); // Output: true
Console.WriteLine($"Valid Email: {isValidEmail}");
Console.WriteLine($"Valid URL: {isValidUrl}");
Console.WriteLine($"Valid IP Address: {isValidIp}");
Console.WriteLine($"Valid Phone Number: {isValidPhone}");
Console.WriteLine($"Valid Postal Code: {isValidPostal}");
Console.WriteLine($"Valid Date: {isValidDate}");
// String Similarity Matching with MatchON
string string1 = "hello world";
string string2 = "hello wrld";
double levenshteinSimilarity = MatchON.GetSimilarity(string1, string2); // Similarity based on Levenshtein Distance
double jaroWinklerSimilarity = MatchON.GetJaroWinklerSimilarity(string1, string2); // Similarity based on Jaro-Winkler
double lcsSimilarity = MatchON.GetLcsSimilarity(string1, string2); // Similarity based on Longest Common Subsequence
Console.WriteLine($"Levenshtein Similarity: {levenshteinSimilarity}"); // Output: Similarity score between 0 and 1
Console.WriteLine($"Jaro-Winkler Similarity: {jaroWinklerSimilarity}"); // Output: Similarity score between 0 and 1
Console.WriteLine($"LCS Similarity: {lcsSimilarity}"); // Output: Similarity score between 0 and 1
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net5.0-windows7.0 is compatible. 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. net6.0-windows7.0 is compatible. net7.0 is compatible. 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. net7.0-windows7.0 is compatible. net8.0 is compatible. 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. net8.0-windows7.0 is compatible. 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. |
.NET Core | netcoreapp2.0 is compatible. netcoreapp2.1 is compatible. netcoreapp2.2 is compatible. netcoreapp3.0 is compatible. netcoreapp3.1 is compatible. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETCoreApp 2.0
- No dependencies.
-
.NETCoreApp 2.1
- No dependencies.
-
.NETCoreApp 2.2
- No dependencies.
-
.NETCoreApp 3.0
- No dependencies.
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.5.2
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net5.0
- No dependencies.
-
net5.0-windows7.0
- No dependencies.
-
net6.0
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
-
net7.0
- No dependencies.
-
net7.0-windows7.0
- No dependencies.
-
net8.0
- No dependencies.
-
net8.0-windows7.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.
Version | Downloads | Last updated |
---|---|---|
1.4.0 | 93 | 11/29/2024 |
1.3.1-beta | 74 | 11/27/2024 |
1.3.0 | 85 | 11/27/2024 |
1.2.0 | 94 | 11/26/2024 |
1.1.0 | 104 | 11/21/2024 |
Release Notes for ValidateON 1.4.0.0
ValidateON 1.4.0.0 introduces significant enhancements to the library, expanding its capabilities and improving developer experience. The highlight of this release is the introduction of broader support for target frameworks, ensuring seamless compatibility with a wide range of platforms and environments. This update makes it easier than ever for developers to integrate ValidateON into their projects regardless of the underlying framework.
In addition to the framework support, version 1.4.0.0 includes all the features and improvements from previous versions, including the powerful MatchON class introduced in version 1.3.0. This class provides robust pattern matching functionality for validating regular expressions and custom patterns, further enhancing the library’s versatility in handling complex data validation scenarios.
Version 1.4.0.0 also continues to support the validation of a broad spectrum of data formats, including email addresses, URLs, phone numbers, credit card numbers, GUIDs, MAC addresses, IBANs, JSON, XML, and Bitcoin wallet addresses. With these capabilities, developers can validate both simple and advanced data types with ease and efficiency.
We encourage users to try ValidateON 1.4.0.0, integrate it into their projects, and provide feedback to help shape future versions of the library.