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

Support System.Text.Rune #219

Merged
merged 6 commits into from
Jan 11, 2025
Merged

Support System.Text.Rune #219

merged 6 commits into from
Jan 11, 2025

Conversation

Joy-less
Copy link
Contributor

Since char is a 16-bit UTF-16 character, it doesn't support characters outside the BMP encoding range and need to be combined as surrogate pairs.
Rune is essentially a 32-bit UTF-32 character, and can support all Unicode characters, including emojis. It's wonderful.

This PR adds:

  • ValueStringBuilder.Append(Rune)
  • ValueStringBuilder.AppendJoin(Rune, IEnumerable<string?>)
  • ValueStringBuilder.AppendJoin<T>(Rune, IEnumerable<T>)

This PR also optimises AppendLine(scoped ReadOnlySpan<char>) by avoiding an unnecessary string allocation. It also removes an unnecessary null check in AppendJoinInternalString<T>(ReadOnlySpan<char>, IEnumerable<T>).

@linkdotnet
Copy link
Owner

Hey @Joy-less
I love it - thank you very much for the PR and especially for fixing my stupid English grammar mistakes! Really appreciated.

One last bid:
Could you add a new ## Added section explaining what you did in the CHANGELOG.md.
This file is used for generating release notes.

@Joy-less
Copy link
Contributor Author

One last bid: Could you add a new ## Added section explaining what you did in the CHANGELOG.md. This file is used for generating release notes.

Done! :)

CHANGELOG.md Outdated Show resolved Hide resolved
@linkdotnet linkdotnet merged commit 8a87e6a into linkdotnet:main Jan 11, 2025
3 checks passed
@Joy-less Joy-less deleted the add-runes branch January 11, 2025 16:08
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.

2 participants