OLD | NEW |
1 part of dartdoc; | |
2 | |
3 // 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 |
4 // 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 |
5 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
6 | 4 |
7 // Generic utility functions. | 5 // Generic utility functions. |
8 | 6 |
9 /** Turns [name] into something that's safe to use as a file name. */ | 7 /** Turns [name] into something that's safe to use as a file name. */ |
10 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); | 8 String sanitize(String name) => name.replaceAll(':', '_').replaceAll('/', '_'); |
11 | 9 |
12 /** Returns the number of times [search] occurs in [text]. */ | 10 /** Returns the number of times [search] occurs in [text]. */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (items.length == 2) return "${items[0]} $conjunction ${items[1]}"; | 68 if (items.length == 2) return "${items[0]} $conjunction ${items[1]}"; |
71 return '${Strings.join(items.getRange(0, items.length - 1), ', ')}' | 69 return '${Strings.join(items.getRange(0, items.length - 1), ', ')}' |
72 ', $conjunction ${items[items.length - 1]}'; | 70 ', $conjunction ${items[items.length - 1]}'; |
73 } | 71 } |
74 | 72 |
75 void writeString(File file, String text) { | 73 void writeString(File file, String text) { |
76 var randomAccessFile = file.openSync(FileMode.WRITE); | 74 var randomAccessFile = file.openSync(FileMode.WRITE); |
77 randomAccessFile.writeStringSync(text); | 75 randomAccessFile.writeStringSync(text); |
78 randomAccessFile.closeSync(); | 76 randomAccessFile.closeSync(); |
79 } | 77 } |
OLD | NEW |