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

Side by Side Diff: lib/uri/encode_decode.dart

Issue 10829459: Deprecate Math object in corelib in favor of dart:math library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/json/json.dart ('k') | lib/uri/uri.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * Javascript-like URI encode/decode functions. 6 * Javascript-like URI encode/decode functions.
7 * The documentation here borrows heavily from the original Javascript 7 * The documentation here borrows heavily from the original Javascript
8 * doumentation on MDN at: 8 * doumentation on MDN at:
9 * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects 9 * https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects
10 */ 10 */
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 /** 104 /**
105 * Convert a byte (2 character hex sequence) in string [s] starting 105 * Convert a byte (2 character hex sequence) in string [s] starting
106 * at position [pos] to its ordinal value 106 * at position [pos] to its ordinal value
107 */ 107 */
108 108
109 int _hexCharPairToByte(String s, int pos) { 109 int _hexCharPairToByte(String s, int pos) {
110 // An alternative to calling parseInt twice would be to take a 110 // An alternative to calling parseInt twice would be to take a
111 // two character substring and call it once, but that may be less 111 // two character substring and call it once, but that may be less
112 // efficient. 112 // efficient.
113 int d1 = Math.parseInt("0x${s[pos]}"); 113 int d1 = parseInt("0x${s[pos]}");
114 int d2 = Math.parseInt("0x${s[pos+1]}"); 114 int d2 = parseInt("0x${s[pos+1]}");
115 return d1 * 16 + d2; 115 return d1 * 16 + d2;
116 } 116 }
117 117
118 /** 118 /**
119 * A JavaScript-like decodeURI function. It unescapes the string [text] and 119 * A JavaScript-like decodeURI function. It unescapes the string [text] and
120 * returns the unescaped string. 120 * returns the unescaped string.
121 */ 121 */
122 String _uriDecode(String text) { 122 String _uriDecode(String text) {
123 StringBuffer result = new StringBuffer(); 123 StringBuffer result = new StringBuffer();
124 List<int> codepoints = new List<int>(); 124 List<int> codepoints = new List<int>();
(...skipping 13 matching lines...) Expand all
138 if (i == text.length) 138 if (i == text.length)
139 break; 139 break;
140 ch = text[i]; 140 ch = text[i];
141 } 141 }
142 result.add(decodeUtf8(codepoints)); 142 result.add(decodeUtf8(codepoints));
143 } 143 }
144 } 144 }
145 return result.toString(); 145 return result.toString();
146 } 146 }
147 147
OLDNEW
« no previous file with comments | « lib/json/json.dart ('k') | lib/uri/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698