Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

String comparers #23

Closed
StephenCleary opened this issue Feb 20, 2019 · 4 comments
Closed

String comparers #23

StephenCleary opened this issue Feb 20, 2019 · 4 comments
Assignees
Milestone

Comments

@StephenCleary
Copy link
Owner

Have a NaturalStringComparer (and case-insensitive variant). Possibly also WithStandardNullHandling wrappers for StringComparer instances.

@StephenCleary StephenCleary self-assigned this Feb 20, 2019
@StephenCleary StephenCleary added this to the v6.1.0 milestone Feb 23, 2019
@StephenCleary
Copy link
Owner Author

Light-up usage of CompareTo and Equals for spans of chars to make natural string comparisons allocation-free on .NET Core 2.1+.

The only really tricky part is GetHashCode. I think this can be passed to the corresponding StringComparer with the full string...

@StephenCleary
Copy link
Owner Author

Also need to consider Utf8StringComparer.

This was referenced Jun 20, 2020
@StephenCleary
Copy link
Owner Author

Splitting out NaturalStringComparer and Utf8StringComparer to their own issues.

This issue is now focused on StringComparer helpers.

@StephenCleary
Copy link
Owner Author

6.1.0 has new APIs:

FixedStringComparer is essentially StringComparer with properties for each type of string comparer (Ordinal, InvariantCultureIgnoreCase, etc) with implementations that do not throw when GetHashCode(null) is called.

IFullComparer<string>.ToStringComparer() wraps a string comparer into a StringComparer-derived type.

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

No branches or pull requests

1 participant