Skip to content

📚 Provides several types of `IComparer` that enables the alphanumeric comparison of two objects

License

Notifications You must be signed in to change notification settings

Roydl/AlphaNumericComparer

Repository files navigation

.NET Core Cross-platform License

Build+Test Commits Source

NuGet NuGet Website Mirror

Roydl.AlphaNumericComparer

Provides several types of IComparer that enables the alphanumeric comparison of two objects.

Default Comparer Alphanumeric Comparer
Alpha10000 Alpha111
Alpha111 Alpha1150
Alpha1150 Alpha10000
Foxtrot10000 Foxtrot111
Foxtrot111 Foxtrot1150
Foxtrot1150 Foxtrot10000
Oscar10000 Oscar111
Oscar111 Oscar1150
Oscar1150 Oscar10000

Usage:

// Can be used in the same way as all `IComparer`.
var comparer = new AlphaNumericComparer<string>();

// Sort any string collection, array, whatever.
var unsortedCollection = new string[] { /* some strings */ };
var sortedCollection = unsortedCollection.OrderBy(str => str, comparer);

// Use it for automatically sorted collections.
var sortedDictionary = new SortedDictionary<string, object>(comparer);
var sortedList = new SortedList<string, object>(comparer);

// Can even be used to sort `System.Windows.Forms` elements or the like.
// In case of `System.Windows.Forms.ListView` you just have to set
// the `ListViewItemSorter` field to automatically sort the list items.
myListView.ListViewItemSorter = new AlphaNumericComparer();

Would you like to help?

  • Star this Project ⭐ and show me that this project interests you 🤗
  • Open an Issue ☕ to give me your feedback and tell me your ideas and wishes for the future 😎
  • Open a Ticket 📫 if you don't have a GitHub account, you can contact me directly on my website 😉
  • Donate by PayPal 💸 to buy me some cakes 🍰

Please note that I cannot fix bugs that are unknown to me. So do yourself and me the favor and get in touch with me. 🤕

About

📚 Provides several types of `IComparer` that enables the alphanumeric comparison of two objects

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages