{"id":28928159,"url":"https://github.com/ktsu-dev/sorting","last_synced_at":"2026-06-13T09:00:36.865Z","repository":{"id":293916681,"uuid":"985270218","full_name":"ktsu-dev/Sorting","owner":"ktsu-dev","description":"A natural string comparison library that correctly sorts alphanumeric strings by comparing embedded numbers as numeric values.","archived":false,"fork":false,"pushed_at":"2026-06-12T23:36:32.000Z","size":175,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-13T01:15:45.351Z","etag":null,"topics":["algorithm","alphanumeric","comparer","natural-sort","sorting","string-comparison"],"latest_commit_sha":null,"homepage":"https://ktsu.dev","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ktsu-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":"COPYRIGHT.md","agents":null,"dco":null,"cla":null}},"created_at":"2025-05-17T12:13:36.000Z","updated_at":"2026-06-12T23:36:35.000Z","dependencies_parsed_at":"2026-02-16T08:04:53.963Z","dependency_job_id":"39ce647f-82eb-427b-8cfb-1e047656bedd","html_url":"https://github.com/ktsu-dev/Sorting","commit_stats":null,"previous_names":["ktsu-dev/sorting"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/ktsu-dev/Sorting","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FSorting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FSorting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FSorting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FSorting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ktsu-dev","download_url":"https://codeload.github.com/ktsu-dev/Sorting/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ktsu-dev%2FSorting/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34278154,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithm","alphanumeric","comparer","natural-sort","sorting","string-comparison"],"created_at":"2025-06-22T14:12:18.216Z","updated_at":"2026-06-13T09:00:36.841Z","avatar_url":"https://github.com/ktsu-dev.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ktsu.Sorting\n\nA .NET library that provides advanced sorting utilities for specialized sorting scenarios.\n\n## Overview\n\nktsu.Sorting offers a collection of sorting utilities to address common sorting challenges that aren't easily handled by standard sorting methods. The library is designed to be modular and extensible, allowing you to use only the components you need.\n\n## Components\n\n### NaturalStringComparer\n\nThe first component in the ktsu.Sorting library is the NaturalStringComparer, which provides natural string comparison by treating embedded numeric parts as numbers rather than characters.\n\n#### Problem\n\nStandard string sorting sorts strings character by character, which results in unintuitive ordering for strings containing numbers:\n\n```\n\"file1.txt\"\n\"file10.txt\"\n\"file2.txt\"\n```\n\n#### Solution\n\nNaturalStringComparer sorts strings the way a human would expect, recognizing and comparing embedded numbers as numeric values:\n\n```\n\"file1.txt\"\n\"file2.txt\"\n\"file10.txt\"\n```\n\n## Installation\n\n### Package Manager\n```\nInstall-Package ktsu.Sorting\n```\n\n### .NET CLI\n```\ndotnet add package ktsu.Sorting\n```\n\n## Usage\n\n### Using NaturalStringComparer\n\n```csharp\nusing ktsu.Sorting;\n\n// Create a comparer instance\nvar comparer = new NaturalStringComparer();\n\n// Compare individual strings\nint result = comparer.Compare(\"file10.txt\", \"file2.txt\"); // Returns \u003e 0 (10 \u003e 2)\n\n// Sort an array using the natural comparer\nstring[] files = { \"file10.txt\", \"file1.txt\", \"file100.txt\", \"file2.txt\" };\nArray.Sort(files, comparer);\n// Result: \"file1.txt\", \"file2.txt\", \"file10.txt\", \"file100.txt\"\n\n// Use with LINQ\nvar sortedFiles = files.OrderBy(file =\u003e file, new NaturalStringComparer());\n```\n\n## Features\n\n### NaturalStringComparer\n- Correctly sorts strings containing numbers in a human-friendly order\n- Handles mixed alphanumeric strings\n- Properly compares strings with leading zeros\n- Fully compatible with .NET's `IComparer\u003cstring\u003e` interface\n- Can be used with `Array.Sort()`, LINQ's `OrderBy()`, and other sorting mechanisms\n\n## Examples\n\n### NaturalStringComparer Examples\n\nThe NaturalStringComparer correctly sorts strings like:\n\n| Input           | Standard Sort    | Natural Sort     |\n|-----------------|------------------|------------------|\n| file1.txt       | file1.txt        | file1.txt        |\n| file10.txt      | file10.txt       | file2.txt        |\n| file2.txt       | file2.txt        | file10.txt       |\n| -------------------------------    | -------------------------------    |\n| z1.doc          | z1.doc           | z1.doc           |\n| z10.doc         | z10.doc          | z2.doc           |\n| z17.doc         | z17.doc          | z3.doc           |\n| z2.doc          | z2.doc           | z10.doc          |\n| z23.doc         | z23.doc          | z17.doc          |\n| z3.doc          | z3.doc           | z23.doc          |\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE.md file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktsu-dev%2Fsorting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fktsu-dev%2Fsorting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fktsu-dev%2Fsorting/lists"}