ZhenSharpHelper 1.0.1

dotnet add package ZhenSharpHelper --version 1.0.1
                    
NuGet\Install-Package ZhenSharpHelper -Version 1.0.1
                    
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="ZhenSharpHelper" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ZhenSharpHelper" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="ZhenSharpHelper" />
                    
Project file
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 ZhenSharpHelper --version 1.0.1
                    
#r "nuget: ZhenSharpHelper, 1.0.1"
                    
#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 ZhenSharpHelper@1.0.1
                    
#: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=ZhenSharpHelper&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=ZhenSharpHelper&version=1.0.1
                    
Install as a Cake Tool

ZhenSharpHelper

NuGet License: MIT

A modern utility toolkit for .NET 8+ – Fast, easy, robust.


✨ Features Overview

ZhenSharpHelper includes specialized helpers and extension methods for daily .NET development:

🅰️ StringHelper

  • Format (template replace, smart ToString)
  • Split/Join (delimiter, fixed length, group)
  • Trim, Normalize (diacritics, accents, unicode, spaces, case)
  • Slugify (SEO-friendly URL conversion)
  • Parse, Mask (mask phone/email/card, extract substring, parseInt/parseDouble)
  • Random (random string, password, guid, number)
  • Regex (IsMatch, MatchGroup, Replace, Validate, Pattern extractor...)

💾 DataHelper

  • ObjectToBytes<T>, BytesToObject<T>
  • StringToBytes, BytesToString
  • BytesToHexString, BytesToBase64, Base64ToBytes
  • Quick conversion between object, bytes, base64, hex, string
  • Data serialization/deserialization helpers

🔐 CryptoHelper

  • Hash: MD5, SHA1, SHA256, SHA512, CRC, Bcrypt, ...
  • Encrypt, Decrypt: Symmetric (AES), PasswordHash, Salt
  • Random token, guid, hash, etc.

✔️ ValidationHelper

  • Email, Phone, Username, Password, CreditCard, ID, Custom pattern
  • Fast IsValidXXX methods for strings and numbers

🕑 DateTimeHelper

  • Format and parse dates (multiple cultures)
  • Convert UTC ↔ Local, any timezone, Unix timestamp
  • Date math: Add, Diff, Age, Business day, Range, ...
  • TimeZoneInfo, convert timezones, get all system zones

📂 FileHelper

  • Quick read/write: XML, Tab, CSV, INI, XLS
  • Path helpers, extension, file size format, secure file ops
  • Convert file to base64, hash file, stream tools, more...

📦 ZipHelper

  • Compress, decompress: zip, rar, 7z, tar, gz (auto-detect)
  • Extract single/multiple files, password support

⚡ Quick Start Examples

🅰️ StringHelper

using ZhenSharpHelper;

// Slugify
string slug = StringHelper.Slugify("Sáng tạo & Đổi mới!"); // "sang-tao-doi-moi"

// Mask
string masked = StringHelper.Mask("0912345678", 3, 3); // "091****678"

// Random password
string pw = StringHelper.RandomString(10);

// Normalize accents
string norm = StringHelper.Normalize("Cà phê sữa đá"); // "Ca phe sua da"

💾 DataHelper

byte[] bytes = DataHelper.StringToBytes("hello world");
string hex = DataHelper.BytesToHexString(bytes);
string b64 = DataHelper.BytesToBase64(bytes);
var obj = DataHelper.BytesToObject<MyClass>(bytes);

🔐 CryptoHelper

string md5 = CryptoHelper.Md5("123456");      // "e10adc3949ba59abbe56e057f20f883e"
string hash = CryptoHelper.Sha256("data");
string encrypted = CryptoHelper.Encrypt("secret", "password123");
string decrypted = CryptoHelper.Decrypt(encrypted, "password123");

✔️ ValidationHelper

bool ok1 = ValidationHelper.IsValidEmail("test@email.com");
bool ok2 = ValidationHelper.IsValidPhone("0912345678");
bool ok3 = ValidationHelper.IsValidUserName("zhen_dev");

🕑 DateTimeHelper

var local = DateTimeHelper.UtcToLocal(DateTime.UtcNow, "SE Asia Standard Time");
var utc = DateTimeHelper.LocalToUtc(DateTime.Now, "SE Asia Standard Time");
string formatted = DateTimeHelper.Format(DateTime.Now, "yyyy-MM-dd HH:mm");
TimeSpan diff = DateTimeHelper.DiffDays(DateTime.Now, DateTime.Now.AddDays(10));

📂 FileHelper

string csv = FileHelper.ReadCsv("data.csv");
FileHelper.WriteXml("data.xml", obj);
string[] lines = FileHelper.ReadTab("data.txt");

📦 ZipHelper

ZipHelper.CompressFolder("data/", "data.zip");
ZipHelper.Extract("data.zip", "output/", "optionalPassword");

📚 Documentation

  • API Reference (coming soon)
  • See code comments (XML doc) and included unit tests for practical usage examples.
  • Most methods are named intuitively and easily discoverable via IntelliSense.
  • Contributions for improved docs and real-world examples are always welcome at the GitHub repository!

❤️ License

This project is licensed under the MIT License.

© 2025 ZhenGlobal - ZhenLong - zhenlong-devel


🙌 Contributing

  • Pull requests, bug reports and suggestions are welcome!
  • Star ⭐ the repo if you find it useful!

🚀 Installation

dotnet add package ZhenSharpHelper
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.1 136 6/22/2025
1.0.0 138 6/22/2025

First stable release