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

Side by Side Diff: sdk/lib/uri/helpers.dart

Issue 12295014: Remove deprecated Strings class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tests/co19/co19-compiler.status » ('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 part of dart.uri; 5 part of dart.uri;
6 6
7 String merge(String base, String reference) { 7 String merge(String base, String reference) {
8 if (base == "") return "/$reference"; 8 if (base == "") return "/$reference";
9 return "${base.substring(0, base.lastIndexOf("/") + 1)}$reference"; 9 return "${base.substring(0, base.lastIndexOf("/") + 1)}$reference";
10 } 10 }
11 11
12 String removeDotSegments(String path) { 12 String removeDotSegments(String path) {
13 List<String> output = []; 13 List<String> output = [];
14 bool appendSlash = false; 14 bool appendSlash = false;
15 for (String segment in path.split("/")) { 15 for (String segment in path.split("/")) {
16 appendSlash = false; 16 appendSlash = false;
17 if (segment == "..") { 17 if (segment == "..") {
18 if (!output.isEmpty && 18 if (!output.isEmpty &&
19 ((output.length != 1) || (output[0] != ""))) output.removeLast(); 19 ((output.length != 1) || (output[0] != ""))) output.removeLast();
20 appendSlash = true; 20 appendSlash = true;
21 } else if ("." == segment) { 21 } else if ("." == segment) {
22 appendSlash = true; 22 appendSlash = true;
23 } else { 23 } else {
24 output.add(segment); 24 output.add(segment);
25 } 25 }
26 } 26 }
27 if (appendSlash) output.add(""); 27 if (appendSlash) output.add("");
28 return Strings.join(output, "/"); 28 return output.join("/");
29 } 29 }
OLDNEW
« no previous file with comments | « sdk/lib/svg/dartium/svg_dartium.dart ('k') | tests/co19/co19-compiler.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698