Xreeple.Bukalemun.Masking
1.0.0-alpha.2508.5
dotnet add package Xreeple.Bukalemun.Masking --version 1.0.0-alpha.2508.5
NuGet\Install-Package Xreeple.Bukalemun.Masking -Version 1.0.0-alpha.2508.5
<PackageReference Include="Xreeple.Bukalemun.Masking" Version="1.0.0-alpha.2508.5" />
<PackageVersion Include="Xreeple.Bukalemun.Masking" Version="1.0.0-alpha.2508.5" />
<PackageReference Include="Xreeple.Bukalemun.Masking" />
paket add Xreeple.Bukalemun.Masking --version 1.0.0-alpha.2508.5
#r "nuget: Xreeple.Bukalemun.Masking, 1.0.0-alpha.2508.5"
#:package Xreeple.Bukalemun.Masking@1.0.0-alpha.2508.5
#addin nuget:?package=Xreeple.Bukalemun.Masking&version=1.0.0-alpha.2508.5&prerelease
#tool nuget:?package=Xreeple.Bukalemun.Masking&version=1.0.0-alpha.2508.5&prerelease
Xreeple.Bukalemun.Masking
A flexible and extensible string masking library for C#.
Supports different masking scenarios, customizable rules, and advanced options like compact masking or removing masked characters entirely.
📦 Installation
Install via NuGet:
dotnet add package Xreeple.Bukalemun.Masking
🚀 Usage
using System;
using Xreeple.Bukalemun.Masking;
class Program
{
static void Main()
{
Console.WriteLine(Mask.Build("helloworld").RevealLast(3).ToString());
// *******rld
}
}
⚙️ API and Methods
All methods are chainable.
General Settings
MaskChar(char c)
Changes the mask character.Mask.Build("mehmet").RevealLast(2).MaskChar('#').ToString(); // ######et
CompactMask(int length)
Replaces any hidden section with a compact block of the specified mask length.Mask.Build("mehmet").RevealFirst(2).CompactMask(3).ToString(); // me***
RemoveMasked(bool remove = true)
Removes masked characters completely instead of replacing them.Mask.Build("mehmet").RevealLast(3).RemoveMasked().ToString(); // met
Masking Rules
RevealFirst(int count)
Reveals the firstcount
characters.Mask.Build("helloworld").RevealFirst(2).ToString(); // he********
RevealLast(int count)
Reveals the lastcount
characters.Mask.Build("helloworld").RevealLast(3).ToString(); // *******rld
RevealRange(int start, int length)
Reveals characters in the given range.Mask.Build("helloworld").RevealRange(2, 4).ToString(); // **llow*****
RevealInitialsPerWord()
Reveals only the first letter of each word.Mask.Build("mehmet emin eker").RevealInitialsPerWord().ToString(); // m***** e*** e***
RevealIf(Func<char, int, bool> predicate)
Reveals characters that match a given condition.
Example: reveal only digits.Mask.Build("abc123xyz").RevealIf((ch, i) => char.IsDigit(ch)).ToString(); // ***123***
Special Rules
PreserveChars(params char[] chars)
Ensures the given characters are always preserved (never masked).Mask.Build("555-123-4567").RevealLast(2).PreserveChars('-').ToString(); // ***-***-**67
🧩 Combination Examples
// Initials per word + compact mask
Console.WriteLine(
Mask.Build("mehmet emin eker")
.RevealInitialsPerWord()
.CompactMask(3)
.ToString()
);
// m*** e*** e***
// Removing masked characters instead of replacing
Console.WriteLine(
Mask.Build("mehmet")
.RevealLast(2)
.RemoveMasked()
.ToString()
);
// et
// Range reveal + preserved characters
Console.WriteLine(
Mask.Build("TR-2025-ABC")
.RevealRange(3, 4)
.PreserveChars('-')
.ToString()
);
// **-2025-***
// Change mask character + reveal first letters
Console.WriteLine(
Mask.Build("hello world")
.RevealInitialsPerWord()
.MaskChar('#')
.CompactMask(2)
.ToString()
);
// h## w##
// Conditional reveal (digits only)
Console.WriteLine(
Mask.Build("user123data456")
.RevealIf((ch, i) => char.IsDigit(ch))
.CompactMask(3)
.ToString()
);
// u***123***456
📄 License
MIT
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. |
This package has 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.0.0-alpha.2508.5 | 149 | 8/29/2025 | |
1.0.0-alpha.2508.4 | 161 | 8/28/2025 | |
1.0.0-alpha.2508.3 | 275 | 8/28/2025 | |
1.0.0-alpha.2508.2 | 269 | 8/28/2025 | |
1.0.0-alpha.2508.1 | 295 | 8/26/2025 |
Initial release.