Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_I18N_NUMBER_FORMATTING_H_ | 5 #ifndef BASE_I18N_NUMBER_FORMATTING_H_ |
| 6 #define BASE_I18N_NUMBER_FORMATTING_H_ | 6 #define BASE_I18N_NUMBER_FORMATTING_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/i18n/base_i18n_export.h" | 10 #include "base/i18n/base_i18n_export.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 | 12 |
| 13 namespace base { | 13 namespace base { |
| 14 | 14 |
| 15 // Return a number formatted with separators in the user's locale. | 15 // Return a number formatted with separators in the user's locale. |
| 16 // Ex: FormatNumber(1234567) | 16 // Ex: FormatNumber(1234567) |
| 17 // => "1,234,567" in English, "1.234.567" in German | 17 // => "1,234,567" in English, "1.234.567" in German |
|
Greg Levin
2016/05/19 19:26:59
... and here too, I guess?
| |
| 18 BASE_I18N_EXPORT string16 FormatNumber(int64_t number); | 18 BASE_I18N_EXPORT string16 FormatNumber(int64_t number); |
| 19 | 19 |
| 20 // Return a number formatted with separators in the user's locale. | 20 // Return a number formatted with separators in the user's locale. |
| 21 // Ex: FormatDouble(1234567.8, 1) | 21 // Ex: FormatDouble(1234567.8, 1) |
| 22 // => "1,234,567.8" in English, "1.234.567,8" in German | 22 // => "1,234,567.8" in English, "1.234.567,8" in German |
| 23 BASE_I18N_EXPORT string16 FormatDouble(double number, int fractional_digits); | 23 BASE_I18N_EXPORT string16 FormatDouble(double number, int fractional_digits); |
| 24 | 24 |
| 25 // Return a percentage formatted with space and symbol in the user's locale. | |
| 26 // Ex: FormatPercent(12) | |
| 27 // => "12%" in English, "12 %" in Romanian | |
|
stevenjb
2016/05/19 15:57:08
nit: combine lines
Greg Levin
2016/05/19 19:26:59
Done.
| |
| 28 BASE_I18N_EXPORT string16 FormatPercent(int number); | |
| 29 | |
| 25 namespace testing { | 30 namespace testing { |
| 26 | 31 |
| 27 // Causes cached formatters to be discarded and recreated. Only useful for | 32 // Causes cached formatters to be discarded and recreated. Only useful for |
| 28 // testing. | 33 // testing. |
| 29 BASE_I18N_EXPORT void ResetFormatters(); | 34 BASE_I18N_EXPORT void ResetFormatters(); |
| 30 | 35 |
| 31 } // namespace testing | 36 } // namespace testing |
| 32 | 37 |
| 33 } // namespace base | 38 } // namespace base |
| 34 | 39 |
| 35 #endif // BASE_I18N_NUMBER_FORMATTING_H_ | 40 #endif // BASE_I18N_NUMBER_FORMATTING_H_ |
| OLD | NEW |