icu::number::FractionRounder Class Reference

A class that defines a rounding strategy based on a number of fraction places and optionally significant digits to be used when formatting numbers in NumberFormatter. More...

#include <numberformatter.h>

Inheritance diagram for icu::number::FractionRounder:
icu::number::Rounder icu::UMemory

Public Member Functions

Rounder withMinDigits (int32_t minSignificantDigits) const
 Ensure that no less than this number of significant digits are retained when rounding according to fraction rules.
Rounder withMaxDigits (int32_t maxSignificantDigits) const
 Ensure that no more than this number of significant digits are retained when rounding according to fraction rules.

Friends

class Rounder

Detailed Description

A class that defines a rounding strategy based on a number of fraction places and optionally significant digits to be used when formatting numbers in NumberFormatter.

To create a FractionRounder, use one of the factory methods on Rounder.

Draft:
This API may be changed in the future versions and was introduced in ICU 60

Definition at line 884 of file numberformatter.h.


Member Function Documentation

Rounder icu::number::FractionRounder::withMaxDigits ( int32_t  maxSignificantDigits  )  const

Ensure that no more than this number of significant digits are retained when rounding according to fraction rules.

For example, with integer rounding, the number 123.4 becomes "123". However, with maximum figures set to 2, 123.4 becomes "120" instead.

This setting does not affect the number of trailing zeros. For example, with fixed fraction of 2, 123.4 would become "120.00".

Parameters:
maxSignificantDigits Round the number to no more than this number of significant figures.
Returns:
A Rounder for chaining or passing to the NumberFormatter rounding() setter.
Draft:
This API may be changed in the future versions and was introduced in ICU 60
Rounder icu::number::FractionRounder::withMinDigits ( int32_t  minSignificantDigits  )  const

Ensure that no less than this number of significant digits are retained when rounding according to fraction rules.

For example, with integer rounding, the number 3.141 becomes "3". However, with minimum figures set to 2, 3.141 becomes "3.1" instead.

This setting does not affect the number of trailing zeros. For example, 3.01 would print as "3", not "3.0".

Parameters:
minSignificantDigits The number of significant figures to guarantee.
Returns:
A Rounder for chaining or passing to the NumberFormatter rounding() setter.
Draft:
This API may be changed in the future versions and was introduced in ICU 60

The documentation for this class was generated from the following file:

Generated on 11 May 2018 for ICU 60.1 by  doxygen 1.6.1