Skip to content

Conversation

StephenCleary
Copy link
Owner

@StephenCleary StephenCleary commented Mar 24, 2022

It may be better (although possibly less efficient) to split up the current situation more:

  1. Define a splitter that parses a string into (ReadOnlyMemory<char>, IsNumeric) splits.
  2. For sequences of the splits, define a comparer.
  3. The provided implementation of this comparer would be a composite comparer: one for numeric splits and one for non-numeric splits.

This would allow several extension points not currently possible with the current PR:

  1. By providing a custom splitter and a custom numeric split comparer, decimals and/or negative numbers could be supported.
  2. By providing a custom non-numeric split comparer, any kind of (sub)string comparer logic could be supported (currently, we are limited to StringComparison). E.g., handling spaces differently.
  3. By providing a custom composite comparer, the user can change the ordering when a numeric split is compared with a non-numeric split.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant