-
Notifications
You must be signed in to change notification settings - Fork 5k
Complex Rune enumeration over spans of UTF-16 and UTF-8 text #111170
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
base: main
Are you sure you want to change the base?
Conversation
- Modified constructor to be `internal` and updated property assignments. - Enhanced `Equals` and `GetHashCode` methods for readability and performance. - Improved XML documentation for clarity and consistency with Unicode terminology. - Updated test methods to reflect changes in `RunePosition`, removing unnecessary assertions and adding new test cases. - Ensured enumerators correctly handle current position in Unicode data.
Note regarding the
|
1 similar comment
Note regarding the
|
src/libraries/System.Private.CoreLib/src/System/Text/RunePosition.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Text/RunePosition.cs
Outdated
Show resolved
Hide resolved
// generally applicable; for example, enumerating scalars from UTF-8 cannot utilize | ||
// this same trick. | ||
|
||
int scalarValue = Rune.ReadFirstRuneFromUtf16Buffer(_remaining); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason Rune.DecodeFromUtf16
isn't used here?
From what I can see DecodeFromUtf16
will have charsConsumer = 1
for invalid sequences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rune.ReadFirstRuneFromUtf16Buffer(_remaining)
is faster than Rune.DecodeFromUtf16
and is also used in SpanRuneEnumerator
.
…tf16Enumerator` and `Utf8Enumerator` structures.
Close #28507