/// <summary> /// Answers a NumberFormat for formatting and parsing percentages for the /// specified Locale. /// </summary> /// /// <param name="locale">the Locale</param> /// <returns>a NumberFormat</returns> public static NumberFormat GetPercentInstance(Locale locale) { IBM.ICU.Text.DecimalFormat icuFormat = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat .GetPercentInstance(locale); String pattern = icuFormat.ToPattern(); return(new DecimalFormat(pattern, new DecimalFormatSymbols(locale))); }
/// <summary> /// Answers a NumberFormat for formatting and parsing integers for the /// specified Locale. /// </summary> /// /// <param name="locale">the Locale</param> /// <returns>a NumberFormat</returns> public static NumberFormat GetIntegerInstance(Locale locale) { IBM.ICU.Text.DecimalFormat icuFormat = (IBM.ICU.Text.DecimalFormat)IBM.ICU.Text.NumberFormat .GetIntegerInstance(locale); String pattern = icuFormat.ToPattern(); DecimalFormat format = new DecimalFormat(pattern, new DecimalFormatSymbols(locale)); format.SetParseIntegerOnly(true); return(format); }
/// <summary> /// Answers the pattern of this DecimalFormat using non-localized pattern /// characters. /// </summary> /// /// <returns>the non-localized pattern</returns> public String ToPattern() { return(dform.ToPattern()); }