-
Notifications
You must be signed in to change notification settings - Fork 213
Support grapheme cluster aware operations via a package #685
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
Comments
An experimental version of this is available in https://pub.dev/packages/characters. Sample APIs for the code listed in the previous comment: String hi = 'Hi 🇩🇰';
print(hi.characters.length);
// Prints 4
print(hi.characters.last);
// Prints 🇩🇰
print(hi.characters.skipLast(1));
// Prints "Hi "
|
We're having serious problems with emojis, that this is suppose to fix. While non-breaking is usually good, in the real world all user input have to use this package. It's not only that developers would have to opt in, they would have to opt in always. |
@marcglasberg we hear you. I'm not saying here that we are not considering breaking API changes on strings, I'm just saying that we're staging it, and the package (with its extension onto String) is phase 1. Can you give the package a try, and let us know how well those APIs work? |
Thanks for this package. Haven't tested it yet but seems promising. |
Marking "done" as the initial package shipped alongside Dart 2.7. We'll continue to increment on the package. For feedback on the package, please use this issue tracker: https://github.com/dart-lang/characters/issues |
Several issues indicate a need for grapheme cluster aware string operations in Dart. The current support is insufficient as covered in #34; summarised here:
The present feature tracks solving this via a new package supporting common string operations in a grapheme cluster aware way. This has the downside that developers would have to "opt in" to use this API, but then also has the huge upside that this would be entirely non-breaking (as opposed to changing the current String API).
The text was updated successfully, but these errors were encountered: