summaryrefslogtreecommitdiff
path: root/platform/darwin/src/string_nsstring.mm
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-09-23 17:22:38 +0300
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-09-26 10:55:47 +0300
commite5cdc4ecf362dadf2da148a22cf97aaf3c9c4ecf (patch)
treeebae02fa6a6da0f4c81cb72df87c6d7359c17acd /platform/darwin/src/string_nsstring.mm
parent9c8295c6a64b6f5b2c9b67fd01633a156481a3c8 (diff)
downloadqtlocation-mapboxgl-e5cdc4ecf362dadf2da148a22cf97aaf3c9c4ecf.tar.gz
[core][android][darwin] Move number format to i18n
Diffstat (limited to 'platform/darwin/src/string_nsstring.mm')
-rw-r--r--platform/darwin/src/string_nsstring.mm31
1 files changed, 2 insertions, 29 deletions
diff --git a/platform/darwin/src/string_nsstring.mm b/platform/darwin/src/string_nsstring.mm
index 382a2acf33..d7c81236ef 100644
--- a/platform/darwin/src/string_nsstring.mm
+++ b/platform/darwin/src/string_nsstring.mm
@@ -27,32 +27,5 @@ std::string lowercase(const std::string &string) {
return result;
}
-std::string formatNumber(double number, const std::string& localeId, const std::string& currency,
- uint8_t minFractionDigits, uint8_t maxFractionDigits) {
-
- static NSNumberFormatter *numberFormatter;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- numberFormatter = [[NSNumberFormatter alloc] init];
- });
-
- numberFormatter.locale = !localeId.empty() ? [NSLocale localeWithLocaleIdentifier:@(localeId.c_str())] : nil;
- numberFormatter.currencyCode = !currency.empty() ? @(currency.c_str()) : nil;
- if (currency.empty()) {
- numberFormatter.minimumFractionDigits = minFractionDigits;
- numberFormatter.maximumFractionDigits = maxFractionDigits;
- numberFormatter.numberStyle = NSNumberFormatterDecimalStyle;
- } else {
- // Reset fraction digits to NSNumberFormatter's default values, so that the
- // system will choose formatting based on number formatter locale.
- numberFormatter.minimumFractionDigits = 0;
- numberFormatter.maximumFractionDigits = 0;
- numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
- }
- NSString *formatted = [numberFormatter stringFromNumber:@(number)];
- std::string result = std::string([formatted UTF8String]);
- return result;
-}
-
-}
-}
+} // namespace platform
+} // namespace mbgl