Class LocalizedNumberRangeFormatter
java.lang.Object
com.ibm.icu.number.NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>
com.ibm.icu.number.LocalizedNumberRangeFormatter
public class LocalizedNumberRangeFormatter
extends NumberRangeFormatterSettings<LocalizedNumberRangeFormatter>
A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods
are available.
Instances of this class are immutable and thread-safe.
- Author:
- sffc
- See Also:
- Status:
- Stable ICU 63.
-
Method Summary
Modifier and TypeMethodDescriptionformatRange(double first, double second) Format the given doubles to a string using the settings specified in the NumberRangeFormatter fluent setting chain.formatRange(int first, int second) Format the given integers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.formatRange(Number first, Number second) Format the given Numbers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.Disassociate the locale from this formatter.Methods inherited from class NumberRangeFormatterSettings
collapse, equals, hashCode, identityFallback, numberFormatterBoth, numberFormatterFirst, numberFormatterSecondModifier and TypeMethodDescriptioncollapse(NumberRangeFormatter.RangeCollapse collapse) Sets the aggressiveness of "collapsing" fields across the range separator.booleaninthashCode()identityFallback(NumberRangeFormatter.RangeIdentityFallback identityFallback) Sets the behavior when the two sides of the range are the same.numberFormatterBoth(UnlocalizedNumberFormatter formatter) Sets the NumberFormatter instance to use for the numbers in the range.numberFormatterFirst(UnlocalizedNumberFormatter formatterFirst) Sets the NumberFormatter instance to use for the first number in the range.numberFormatterSecond(UnlocalizedNumberFormatter formatterSecond) Sets the NumberFormatter instances to use for the second number in the range.
-
Method Details
-
formatRange
Format the given integers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.- Parameters:
first- The first number in the range, usually to the left in LTR locales.second- The second number in the range, usually to the right in LTR locales.- Returns:
- A FormattedNumberRange object; call .toString() to get the string.
- See Also:
- Status:
- Stable ICU 63.
-
formatRange
Format the given doubles to a string using the settings specified in the NumberRangeFormatter fluent setting chain.- Parameters:
first- The first number in the range, usually to the left in LTR locales.second- The second number in the range, usually to the right in LTR locales.- Returns:
- A FormattedNumberRange object; call .toString() to get the string.
- See Also:
- Status:
- Stable ICU 63.
-
formatRange
Format the given Numbers to a string using the settings specified in the NumberRangeFormatter fluent setting chain.- Parameters:
first- The first number in the range, usually to the left in LTR locales.second- The second number in the range, usually to the right in LTR locales.- Returns:
- A FormattedNumberRange object; call .toString() to get the string.
- Throws:
IllegalArgumentException- if first or second is null- See Also:
- Status:
- Stable ICU 63.
-
withoutLocale
Disassociate the locale from this formatter.- Returns:
- The fluent chain.
- Status:
- Stable ICU 74.
-