It requires a little tweaking of the DecimalFormat returned by NumberFormat.getCurrencyInstance()
to do it in a locale-independent manner. Here's what I did (tested on Android):
DecimalFormat formatter = (DecimalFormat)NumberFormat.getCurrencyInstance();
String symbol = formatter.getCurrency().getSymbol();
formatter.setNegativePrefix(symbol+"-"); // or "-"+symbol if that's what you need
formatter.setNegativeSuffix("");
IIRC, Currency.getSymbol()
may not return a value for all locales for all systems, but it should work for the major ones (and I think it has a reasonable fallback on its own, so you shouldn't have to do anything)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…