com.github.isaiahnoelpulidosalazar.nugetpackage
1.1.2
dotnet add package com.github.isaiahnoelpulidosalazar.nugetpackage --version 1.1.2
NuGet\Install-Package com.github.isaiahnoelpulidosalazar.nugetpackage -Version 1.1.2
<PackageReference Include="com.github.isaiahnoelpulidosalazar.nugetpackage" Version="1.1.2" />
<PackageVersion Include="com.github.isaiahnoelpulidosalazar.nugetpackage" Version="1.1.2" />
<PackageReference Include="com.github.isaiahnoelpulidosalazar.nugetpackage" />
paket add com.github.isaiahnoelpulidosalazar.nugetpackage --version 1.1.2
#r "nuget: com.github.isaiahnoelpulidosalazar.nugetpackage, 1.1.2"
#:package com.github.isaiahnoelpulidosalazar.nugetpackage@1.1.2
#addin nuget:?package=com.github.isaiahnoelpulidosalazar.nugetpackage&version=1.1.2
#tool nuget:?package=com.github.isaiahnoelpulidosalazar.nugetpackage&version=1.1.2
com.github.isaiahnoelpulidosalazar.nugetpackage
com.github.isaiahnoelpulidosalazar.nugetpackage A NuGet package for .NET that simplifies validation through a custom Check class, a custom Convert class for data conversion, and a dedicated class that simplifies file IO through SimpleFileHandler.
Features
The package operates under the nugetpackage namespace and contains several distinct modules to help keep your codebase clean and readable:
Validation (Check)
A robust validation class to simplify standard string, format, and date checks.
- Email: Highly customizable email domain validation (allows whitelisting specific domain names, extensions, or full domains).
- Phone Numbers: Validates Philippine mobile numbers (
09,+639,639). - Strings: Check for spaces, symbols, pure numerical strings, or presence of numbers.
- Time/Dates: Easily calculate the remaining time between two
DateTimeobjects (Days, Hours, Minutes, Seconds).
Cryptography (Cipher)
A class to implement classic and recreational cipher techniques for string encryption.
- Transposition Cipher
- Giovanni Cipher
- Keyword Cipher
- Caesar Cipher
Data Conversion (Convert)
Effortless type casting, text manipulation, and data encoding.
- Base64, Hex, and Binary encoding/decoding.
- String reversal and Byte-array conversions (
UTF8). - Quick string parsing to
Int,Double,Long, andFloat.
File & Resource Handling (SimpleFileHandler)
Static methods to rapidly read, write, and extract files.
- Rapid
Read(),Write(), andAppend()for text files. - Embedded Resources: Use
ProjectToLocation()to easily extract and copy files marked as 'Embedded Resource' from your executing assembly to a physical directory.
Sorting Algorithms (SortAlgorithms)
A massive suite of sorting algorithms implemented in C# as quick plug-and-play functions for integer and double arrays.
- Standard: Quick Sort, Merge Sort, Heap Sort, Selection Sort, Insertion Sort, Bubble Sort.
- Advanced/Niche: Tim Sort, Intro Sort, Cocktail Shaker Sort, Shell Sort, Pigeonhole Sort, Bead Sort, Patience Sorting, and even Bogo Sort!
Installation
Install the package via the .NET CLI:
dotnet add package com.github.isaiahnoelpulidosalazar.nugetpackage
Or via the NuGet Package Manager Console:
Install-Package com.github.isaiahnoelpulidosalazar.nugetpackage
Quick Usage Examples
To use the package, simply include the namespace at the top of your file:
using nugetpackage;
1. Validating Phone Numbers & Dates (Check)
// Validate Philippine Phone Numbers
bool isValidPhone = Check.IsAValidPhilippineMobileNumber("+639123456789");
Console.WriteLine(isValidPhone); // True
// Calculate time left
DateTime now = DateTime.Now;
DateTime future = now.AddDays(5).AddHours(2);
Console.WriteLine($"Days left: {Check.HowManyDaysLeft(now, future)}"); // ~5.083
2. Custom Email Validation (Check.Email)
// Setup strict domain rules
Check.Email.AddValidDomainName("gmail");
Check.Email.AddValidDomainExtension("com");
bool isEmailValid = Check.Email.IsValid("user@gmail.com");
Console.WriteLine(isEmailValid); // True
3. File Handling & Resource Extraction (SimpleFileHandler)
// Write, Append, and Read text
SimpleFileHandler.Write("log.txt", "Process started.\n");
SimpleFileHandler.Append("log.txt", "Process finished.\n");
Console.WriteLine(SimpleFileHandler.Read("log.txt"));
// Extract an Embedded Resource to a physical location
Assembly myAssembly = Assembly.GetExecutingAssembly();
SimpleFileHandler.ProjectToLocation(myAssembly, "MyConfig.json", @"C:\AppConfigs");
4. Text Encryption (Cipher)
string encrypted = Cipher.CaesarCipher("HELLO WORLD", shift: 3);
Console.WriteLine(encrypted); // KHOOR ZRUOG
5. String & Data Conversions (Convert)
// String Reversal
string reversed = Convert.Reverse("C# is awesome");
// Base64 Encoding
string encoded = Convert.ToBase64("Secret Message");
string decoded = Convert.FromBase64(encoded);
// Hex Conversions
string hexValue = Convert.ToHex("Hello");
Console.WriteLine(hexValue); // 48656C6C6F
6. Sorting Arrays (SortAlgorithms)
int[] array = { 5, 2, 9, 1, 5, 6 };
// Using QuickSort
int[] sortedArray = SortAlgorithms.QuickSort(array);
// Using more exotic sorts
int[] introSorted = SortAlgorithms.IntroSort(array);
Console.WriteLine(string.Join(", ", sortedArray)); // 1, 2, 5, 5, 6, 9
Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. 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. |
-
net8.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.