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

Side by Side Diff: sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.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
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 dartdoc; 5 part of dartdoc;
6 6
7 // Generic utility functions. 7 // Generic utility functions.
8 8
9 /** Turns [name] into something that's safe to use as a file name. */ 9 /** Turns [name] into something that's safe to use as a file name. */
10 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); 10 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_');
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 return elements; 61 return elements;
62 } 62 }
63 63
64 /** 64 /**
65 * Joins [items] into a single, comma-separated string using [conjunction]. 65 * Joins [items] into a single, comma-separated string using [conjunction].
66 * E.g. `['A', 'B', 'C']` becomes `"A, B, and C"`. 66 * E.g. `['A', 'B', 'C']` becomes `"A, B, and C"`.
67 */ 67 */
68 String joinWithCommas(List<String> items, [String conjunction = 'and']) { 68 String joinWithCommas(List<String> items, [String conjunction = 'and']) {
69 if (items.length == 1) return items[0]; 69 if (items.length == 1) return items[0];
70 if (items.length == 2) return "${items[0]} $conjunction ${items[1]}"; 70 if (items.length == 2) return "${items[0]} $conjunction ${items[1]}";
71 return '${Strings.join(items.getRange(0, items.length - 1), ', ')}' 71 return '${items.getRange(0, items.length - 1).join(', ')}'
72 ', $conjunction ${items[items.length - 1]}'; 72 ', $conjunction ${items[items.length - 1]}';
73 } 73 }
74 74
75 void writeString(File file, String text) { 75 void writeString(File file, String text) {
76 var randomAccessFile = file.openSync(FileMode.WRITE); 76 var randomAccessFile = file.openSync(FileMode.WRITE);
77 randomAccessFile.writeStringSync(text); 77 randomAccessFile.writeStringSync(text);
78 randomAccessFile.closeSync(); 78 randomAccessFile.closeSync();
79 } 79 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/dartdoc/lib/dartdoc.dart ('k') | sdk/lib/_internal/dartdoc/lib/src/markdown/block_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698