Index: chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java |
index 524d852de5ba0adf1f2b8ffb244449073a877a03..dd8a8a19240febe3460301f8e51924f0896d9be7 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/CurrencyStringFormatter.java |
@@ -78,14 +78,21 @@ public class CurrencyStringFormatter { |
// The spec does not limit the currencies to official ISO 4217 currency code list, which |
// is used by java.util.Currency. For example, "BTX" (bitcoin) is not an official ISO |
// 4217 currency code, but is allowed by the spec. |
- currencySymbol = currencyCode; |
+ currencySymbol = ""; |
defaultFractionDigits = 0; |
} |
- // If the currency symobl is the same as the currency code, do not display it as part of the |
- // amount. The UI already shows the currency code, so there's no need to show duplicate |
- // information. |
- mCurrencySymbol = currencySymbol.equals(currencyCode) ? "" : currencySymbol; |
+ // If the prefix of the currency symbol matches the prefix of the currency code, remove the |
+ // matching prefix from the symbol. The UI already shows the currency code, so there's no |
+ // need to show duplicate information. |
+ String symbol = ""; |
+ for (int i = 0; i < currencySymbol.length(); i++) { |
+ if (i >= currencyCode.length() || currencySymbol.charAt(i) != currencyCode.charAt(i)) { |
+ symbol = currencySymbol.substring(i); |
+ break; |
+ } |
+ } |
+ mCurrencySymbol = symbol; |
mDefaultFractionDigits = defaultFractionDigits; |