| OLD | NEW |
| 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 * This is a private class internal to DateFormat which is used for formatting | 6 * This is a private class internal to DateFormat which is used for formatting |
| 7 * particular fields in a template. e.g. if the format is hh:mm:ss then the | 7 * particular fields in a template. e.g. if the format is hh:mm:ss then the |
| 8 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows | 8 * fields would be "hh", ":", "mm", ":", and "ss". Each type of field knows |
| 9 * how to format that portion of a date. | 9 * how to format that portion of a date. |
| 10 */ | 10 */ |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 parse(_Stream input, _DateBuilder dateFields) { | 83 parse(_Stream input, _DateBuilder dateFields) { |
| 84 return parseLiteral(input); | 84 return parseLiteral(input); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void patchQuotes() { | 87 void patchQuotes() { |
| 88 if (pattern == "''") { | 88 if (pattern == "''") { |
| 89 pattern = "'"; | 89 pattern = "'"; |
| 90 } else { | 90 } else { |
| 91 pattern = pattern.substring(1, pattern.length - 1); | 91 pattern = pattern.substring(1, pattern.length - 1); |
| 92 var twoEscapedQuotes = new RegExp(@"''"); | 92 var twoEscapedQuotes = new RegExp(r"''"); |
| 93 pattern = pattern.replaceAll(twoEscapedQuotes, "'"); | 93 pattern = pattern.replaceAll(twoEscapedQuotes, "'"); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 /* | 98 /* |
| 99 * Represents a field in the pattern that formats some aspect of the | 99 * Represents a field in the pattern that formats some aspect of the |
| 100 * date. Consists primarily of a switch on the particular pattern characters | 100 * date. Consists primarily of a switch on the particular pattern characters |
| 101 * to determine what to do. | 101 * to determine what to do. |
| 102 */ | 102 */ |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 var basicString = toBePrinted.toString(); | 394 var basicString = toBePrinted.toString(); |
| 395 if (basicString.length >= width) return basicString; | 395 if (basicString.length >= width) return basicString; |
| 396 var buffer = new StringBuffer(); | 396 var buffer = new StringBuffer(); |
| 397 for (var i = 0; i < width - basicString.length; i++) { | 397 for (var i = 0; i < width - basicString.length; i++) { |
| 398 buffer.add('0'); | 398 buffer.add('0'); |
| 399 } | 399 } |
| 400 buffer.add(basicString); | 400 buffer.add(basicString); |
| 401 return buffer.toString(); | 401 return buffer.toString(); |
| 402 } | 402 } |
| 403 } | 403 } |
| OLD | NEW |