-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
There should be an easy way of declaring character codes. #2093
Comments
Added Area-Language, Triaged labels. |
I think this is a library issue. Removed Area-Language label. |
This comment was originally written by @ahmetaa Perhaps overloading [] operator for String can help this? int c = 'a'[0]; |
The Library version is "x".codeUnitAt(0). The alternative is to coopt some operator to give the same result as .codeUnitAt, e.g., "xy"(1) or "xy"/1. It's not going to be pretty. It can be made a compile-time constant, and may be defined to only work on single-character strings, so maybe even "x"() or ~"x" or -"x". It needs spec work to guarantee that it's a compile-time constant, which we do need for switches and similar, so it might as well be done properly. (The [] operator is already defined on string, and it returns a single code-unit string). Removed Type-Defect, Area-Library labels. |
git log --oneline --no-decorate 3c060aae47985e9a248b850f1d0450304a5c97e3..8c363fe26f059c3063f1129adbb3c4e22a8ce954 8c363fe2 Restore default server for uploader command (#2102) 154a1419 Fix #28 -- escaping arguments as mentioned in TODO (#2093) bb2b8b28 Remove validation for library file paths (#2067) Change-Id: I795a8d58144003129b36e481b2693656035b2057 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/97638 Commit-Queue: Sigurd Meldgaard <sigurdm@google.com> Reviewed-by: Nate Bosch <nbosch@google.com> Reviewed-by: Jonas Jensen <jonasfj@google.com>
Revisions updated by `dart tools/rev_sdk_deps.dart`. ecosystem (https://github.com/dart-lang/ecosystem/compare/ed39318..dcf5c4f): dcf5c4f 2023-09-20 Parker Lougheed Simplify dart_flutter_team_lints install instructions (#172) http (https://github.com/dart-lang/http/compare/decefa6..1251619): 1251619 2023-09-19 Brian Quinlan Add the ability to control the URL cache. (#1020) mockito (https://github.com/dart-lang/mockito/compare/412c0be..097e563): 097e563 2023-09-19 Ilya Yanok Add a missing dummy `bool` value shelf (https://github.com/dart-lang/shelf/compare/e2a02b7..4851978): 4851978 2023-09-20 Kevin Moore shelf_router_generator: prepare to release v1.1.0 (#380) test (https://github.com/dart-lang/test/compare/6449495..8191a35): 8191a355 2023-09-20 Nate Bosch Drop a TODO about running browser after compile (#2094) d8e9d87d 2023-09-18 Nate Bosch Add a silent reporter (#2093) tools (https://github.com/dart-lang/tools/compare/70d778d..3c248df): 3c248df 2023-09-21 Devon Carew misc infra updates for dart-lang/tools (#165) Change-Id: I436a34847db75f45a20b8c18996419f88214485f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/327280 Auto-Submit: Devon Carew <devoncarew@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This issue was originally filed by @ahmetaa
Currently defining a character code in Dart is not straight forward. An
example from http://www.dartlang.org/articles/io/ :
int semicolon = ';'.charCodeAt(0);
It is prety common to define or make comparisons with char codes in the code. Can there be an easier way of doing this in Dart?
The text was updated successfully, but these errors were encountered: