How to convert the following code in C #
DecimalFormat form String pattern = ""; for (int i = 0; i < nPlaces - nDec - 2; i++) { pattern += "#"; } pattern += "0."; for (int i = nPlaces - nDec; i < nPlaces; i++) { pattern += "0"; } form = (DecimalFormat) NumberFormat.getInstance(); DecimalFormatSymbols symbols = form.getDecimalFormatSymbols(); symbols.setDecimalSeparator('.'); form.setDecimalFormatSymbols(symbols); form.setMaximumIntegerDigits(nPlaces - nDec - 1); form.applyPattern(pattern);
EDIT The specific problem is that I do not want the decimal separator to be changed using Locale (for example, some Locales would use ",").
java c # decimalformat
peter.murray.rust
source share