ICU 76.1: icu::number::IntegerWidth Class Reference

ICU 76.1 76.1

Public Member Functions | Static Public Member Functions | Friends
icu::number::IntegerWidth Class Reference

A class that defines the strategy for padding and truncating integers before the decimal separator. More...

`#include <numberformatter.h>`

Inheritance diagram for icu::number::IntegerWidth:

## Public Member Functions
IntegerWidth | truncateAt (int32_t maxInt)
| Truncate numbers exceeding a certain number of numerals before the decimal separator.

## Static Public Member Functions
static IntegerWidth | zeroFillTo (int32_t minInt)
| Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator.

## Friends
struct | impl::MacroProps
struct | impl::MicroProps
class | impl::NumberFormatterImpl
class | impl::MutablePatternModifier
class | impl::ImmutablePatternModifier
class | impl::NumberPropertyMapper
class | impl::GeneratorHelpers

## Detailed Description

A class that defines the strategy for padding and truncating integers before the decimal separator.

To create an IntegerWidth, use one of the factory methods.

Stable
  ICU 60

See also
  NumberFormatter

Definition at line 989 of file numberformatter.h.

## Member Function Documentation

## ◆ truncateAt()

IntegerWidth icu::number::IntegerWidth::truncateAt | ( | int32_t | maxInt | ) |

Truncate numbers exceeding a certain number of numerals before the decimal separator.

For example, with maxInt=3, the number 1234 will get printed as "234".

Parameters

  maxInt | The maximum number of places before the decimal separator. maxInt == -1 means no truncation.

Returns
  An IntegerWidth for passing to the NumberFormatter integerWidth() setter.

Stable
  ICU 60

## ◆ zeroFillTo()

static IntegerWidth icu::number::IntegerWidth::zeroFillTo | ( | int32_t | minInt | ) |
| static

Pad numbers at the beginning with zeros to guarantee a certain number of numerals before the decimal separator.

For example, with minInt=3, the number 55 will get printed as "055".

Parameters

  minInt | The minimum number of places before the decimal separator.

Returns
  An IntegerWidth for chaining or passing to the NumberFormatter integerWidth() setter.

Stable
  ICU 60

## Friends And Related Symbol Documentation

## ◆ impl::GeneratorHelpers

friend class impl::GeneratorHelpers
| friend

Definition at line 1075 of file numberformatter.h.

## ◆ impl::ImmutablePatternModifier

friend class impl::ImmutablePatternModifier
| friend

Definition at line 1069 of file numberformatter.h.

## ◆ impl::MacroProps

friend struct impl::MacroProps
| friend

Definition at line 1061 of file numberformatter.h.

## ◆ impl::MicroProps

friend struct impl::MicroProps
| friend

Definition at line 1062 of file numberformatter.h.

## ◆ impl::MutablePatternModifier

friend class impl::MutablePatternModifier
| friend

Definition at line 1068 of file numberformatter.h.

## ◆ impl::NumberFormatterImpl

friend class impl::NumberFormatterImpl
| friend

Definition at line 1065 of file numberformatter.h.

## ◆ impl::NumberPropertyMapper

friend class impl::NumberPropertyMapper
| friend

Definition at line 1072 of file numberformatter.h.

## Field Documentation

## ◆ errorCode

UErrorCode icu::number::IntegerWidth::errorCode

Definition at line 1024 of file numberformatter.h.

## ◆ fFormatFailIfMoreThanMaxDigits

bool icu::number::IntegerWidth::fFormatFailIfMoreThanMaxDigits

Definition at line 1022 of file numberformatter.h.

## ◆ fMaxInt

impl::digits_t icu::number::IntegerWidth::fMaxInt

Definition at line 1021 of file numberformatter.h.

## ◆ fMinInt

impl::digits_t icu::number::IntegerWidth::fMinInt

Definition at line 1020 of file numberformatter.h.

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

- i18n/unicode/numberformatter.h