Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Unified Diff: samples/logo/logo.dart

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | samples/swarm/Decoder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/logo/logo.dart
diff --git a/samples/logo/logo.dart b/samples/logo/logo.dart
index 92c6f92efa5e768e08a90607bb36efff26d7f8b2..c81f629b3bbb2f7f06b0334c8364996c16a54e13 100644
--- a/samples/logo/logo.dart
+++ b/samples/logo/logo.dart
@@ -51,24 +51,8 @@ class Color {
_parseHex(hex.substring(3, 5))/255,
_parseHex(hex.substring(5, 7))/255);
- // This should be in the core library. Issue #233
static int _parseHex(String hex) {
- final codes = hex.charCodes;
- var number = 0;
- for (var i = 0; i < codes.length; i++) {
- final code = codes[i];
- var digit;
- if (code >= 48 && code <= 57) { // 0-9
- digit = code - 48;
- } else if (code >= 97 && code <= 102) { // a-f
- digit = code - 97 + 10;
- } else {
- throw "Invalid hex string: '$hex'";
- }
- number *= 16; // shift previous digits left one place
- number += digit;
- }
- return number;
+ return int.parse(hex, radix: 16);
}
String get hex {
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | samples/swarm/Decoder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698