IntelliDataSort 1.0.0

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

IntelliDataSort โ€“ HumanSort Engine

Secure, culture-aware sorting and parsing engine for real-world string data

IntelliDataSort (powered by HumanSort) is a high-precision sorting library for .NET designed to safely handle untrusted, mixed-format, and international string data.

It combines:

  • Explicit type declaration (no ambiguous auto-detection)
  • Strict validation
  • Secure parsing
  • Stable, human-friendly sorting
  • Parsed output for filtering & auditing

Ideal for data grids, reports, logs, CSV/Excel imports, admin panels, and console tooling where correctness and security matter.


๐Ÿ” What Problems Does It Solve?

Common issues with traditional sorting:

  • "file10" sorted before "file2"
  • "โ‚น1,00,000" treated as invalid
  • "04/07/2023" misinterpreted across cultures
  • Injection payloads silently accepted
  • Mixed formats producing unstable results

HumanSort solves these with explicit type declaration and strict validation.


โœจ Core Capabilities

Sorting Types

  • Human-friendly natural string sorting
  • Numeric sorting (int, decimal, scientific, hex, binary)
  • Culture-aware date & time sorting
  • Currency sorting with regional rules
  • Percentage sorting with strict validation
  • File size sorting (B โ†’ YB, decimal & binary)
  • IP address sorting (IPv4)
  • Semantic version sorting (SemVer)

Filtering Support

  • Parsed output exposed via out parameter for post-sort filtering
  • Invalid values explicitly identified (parsed = null)
  • No silent coercion or guessing

๐Ÿ“ฆ Installation (NuGet)

dotnet add package IntelliDataSort

๐Ÿš€ Quick Start

using IntelliDataSort;

var sorter = new HumanSort();

var data = new List<string>
{
    "file10",
    "file2",
    "file1"
};

// REQUIRED: Explicitly specify column type
var result = sorter.Sort(
    data,
    HumanSort.ColumnType.NaturalString,  // โ† MANDATORY parameter
    ascending: true,
    nullHandling: HumanSort.NullHandling.NullsFirst
);

// Result: ["file1", "file2", "file10"]

โš ๏ธ Critical API Change: Explicit Type Declaration Required

forceType is now a REQUIRED non-nullable parameter.
Auto-detection has been removed to prevent silent failures and ambiguous behavior.

โœ… Correct usage:

sorter.Sort(data, HumanSort.ColumnType.Number, true);

โŒ Will not compile:

// Missing required forceType parameter
sorter.Sort(data, true); 

Why this change? Ambiguous inputs like "1.234" could mean 1.234 (decimal) or 1234 (thousands separator) depending on culture. HumanSort requires explicit intent to guarantee deterministic results.


๐Ÿงฉ Supported Column Types

ColumnType Description Example Values
Number Integers, decimals, scientific notation 123, -45.67, 1.23e4, 0xFF
DateTime Culture-aware date & time parsing 2023-07-04, 04/07/2023
Currency Symbol & ISO-aware currency parsing $100, โ‚น1,00,000, 100 EUR
Percentage Strict % parsing 10%, (15%), 25 pct
FileSize B โ†’ YB (decimal & binary) 1 KB, 1 MiB, 0.5 GB
IpAddress Exact IPv4 sorting 192.168.1.1, 10.0.0.1
NaturalString Human-friendly alphanumeric sorting file1, file10, doc_v2
Version Semantic versioning (SemVer) 1.0.0, 2.0.0-beta, 3.14.159
PlainString Ordinal string comparison "apple", "banana"

๐Ÿ’ฑ Currency Sorting

var data = new List<string>
{
    "(โ‚น1,00,000)",
    "โ‚น10",
    "โ‚น1,00,00,000"
};

var result = sorter.Sort(
    data,
    HumanSort.ColumnType.Currency,
    ascending: true,
    nullHandling: HumanSort.NullHandling.NullsFirst
);

โœ” Parentheses negatives: (โ‚น100) โ†’ -100
โœ” Indian numbering system (lakh/crore)
โœ” Strict validation (rejects ambiguous inputs)
โœ” No mixed-currency coercion


๐Ÿ“… Date Sorting (Culture-Aware)

var culture = new CultureInfo("en-GB"); // Day-first culture

var data = new List<string>
{
    "04/07/2023",  // 4 July 2023 (not April!)
    "01/12/2024",
    "07/08/2022"
};

var result = sorter.Sort(
    data,
    HumanSort.ColumnType.DateTime,
    ascending: true,
    nullHandling: null,
    dateTimeCulture: culture,  // โ† Only valid for DateTime
    out var parsedValues
);

โš ๏ธ dateTimeCulture parameter is only accepted when forceType = ColumnType.DateTime. Using it with other types throws ArgumentException.


๐Ÿ“Š Percentage Sorting

var data = new List<string>
{
    "10%",
    "(15%)",   // โ†’ -15
    "25 pct",
    "50 percent"
};

var result = sorter.Sort(
    data,
    HumanSort.ColumnType.Percentage,
    ascending: true
);

Accepted: 10%, (15%), 25 pct, 50 percent, -30%
Rejected: 100 (no % indicator), $50, 10% KB, percent 50


๐Ÿงช Parsed Values Output

All sort operations support an out parameter for parsed values:

var result = sorter.Sort(
    data,
    HumanSort.ColumnType.Number,
    ascending: true,
    nullHandling: null,
    out List<(string original, object parsed)> parsedValues
);

// Inspect parsed values for filtering/auditing
foreach (var (original, parsed) in parsedValues)
{
    Console.WriteLine($"{original} โ†’ {parsed ?? "INVALID"}");
}
Input Parsed Value Type Notes
Valid item double, DateTime, etc. Type matches ColumnType
Invalid null Explicitly marked invalid

๐Ÿ” Security Model

Zero-trust input philosophy: Ambiguous or potentially malicious inputs are rejected, not guessed.

Actively Rejected Inputs

  • SQL injection attempts (' OR 1=1 --)
  • XSS/script payloads (<script>)
  • HTML/XML fragments
  • Unicode control/invisible characters
  • Mixed units (100$โ‚ฌ)
  • Extreme numeric values (DoS prevention)
  • Scientific notation in currencies ($1e5)
  • Roman numerals with currency symbols ($X)

Security Note: This parser implements strict allow-list validation per OWASP guidelines. It reduces injection risk at the input boundary but does not replace downstream security controls (parameterized queries, output encoding, access control).


โš™๏ธ Public API Surface

Visible Types (Users Can Access)

namespace IntelliDataSort
{
    public sealed class HumanSort
    {
        public enum ColumnType { ... }
        public enum NullHandling { ... }
        public enum NaturalSortCaseSensitivity { ... }
        
        public HumanSort();
        
        public IReadOnlyList<string> Sort(
            IEnumerable<string> data,
            ColumnType forceType,          // โ† REQUIRED (non-nullable)
            bool ascending = true,
            NullHandling? nullHandling = null
        );
        
        public IReadOnlyList<string> Sort(
            IEnumerable<string> data,
            ColumnType forceType,
            bool ascending,
            NullHandling? nullHandling,
            out List<(string original, object parsed)> parsedValues
        );
        
        public IReadOnlyList<string> Sort(
            IEnumerable<string> data,
            ColumnType forceType,
            bool ascending,
            NullHandling? nullHandling,
            CultureInfo dateTimeCulture,   // โ† DateTime only
            out List<(string original, object parsed)> parsedValues
        );
        
        // ===== VALIDATION METHODS =====
        public bool IsValidCurrencyLiteral(string input);
        public bool IsValidCurrencyLiteral(string input, string expectedCurrencyCode);
        public static bool IsValidIpAddressExact(string input);


        public IReadOnlyCollection<string> GetCurrencySymbols();
        public IReadOnlyCollection<string> GetCurrencyCodes();
    }
}

Hidden Implementation Details

  • All validators (NumberValidator, CurrencyValidator, etc.) โ†’ internal
  • All helpers (VersionParser, TokenListComparer, etc.) โ†’ private/internal
  • Configuration classes โ†’ private sealed
  • Regex patterns & dictionaries โ†’ private static readonly

๐Ÿงพ License

Proprietary License

ยฉ 2026 Mohd Nasrullah Kazmi (IntelliDataSort).
All rights reserved.

Unauthorized copying, modification, distribution, or commercial use is prohibited unless explicitly permitted by the author.


Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.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.0.0 97 2/7/2026