# DecimalSFI class
{: .no_toc }

Formats a number as whole-number digits for the **D** identifier.

**DecimalSFI** is a format identifier class. It implements [**IStringFormatIdentifier**](/tB/Packages/Contributed/Fmt/IStringFormatIdentifier.md) and matches the identifier **D** or **d** in any case. [**StringHelper**](/tB/Packages/Contributed/Fmt/StringHelper.md) registers it, so `{0:D}` in a call to [**StringFormat**](/tB/Packages/Contributed/Fmt/PublicEntryPoints/StringFormat.md) uses it for a numeric value. The class is predeclared, and its two members are reached through the interface.

## Output

The value is passed to **Format$** with a format of zeros. Without a precision the format is `0`. With a precision *n* the format is *n* zeros, so the result has at least *n* digits and shorter numbers are padded on the left with zeros. A value with a fractional part is rounded to a whole number, and a negative number keeps its minus sign in front of the padding. A value with more digits than *n* is not shortened.

```tb check_build check_run
Debug.Print StringFormat("{0:D}", 42)     ' 42
Debug.Print StringFormat("{0:D5}", 42)    ' 00042
Debug.Print StringFormat("{0:D3}", -5)    ' -005
Debug.Print StringFormat("{0:D}", 3.7)    ' 4
Debug.Print StringFormat("{0:D2}", 1234)  ' 1234
Debug.Print StringFormat("{0:D2}:{1:D2}", 7, 5)  ' 07:05
```

## Members

- **IsIdentifierMatch** returns **True** when the specifier's [**identifier**](/tB/Packages/Contributed/Fmt/StringFormatSpecifier/identifier.md) is `D` or `d`.
- **GetFormattedValue** returns the value formatted as described above. It reads the specifier's [**Precision**](/tB/Packages/Contributed/Fmt/StringFormatSpecifier/Precision.md).

Both are implemented as private members of the interface. [**GeneralNumericSFI**](/tB/Packages/Contributed/Fmt/GeneralNumericSFI.md) calls this class for **Integer** and **Long** values.

## See Also

- [IStringFormatIdentifier](/tB/Packages/Contributed/Fmt/IStringFormatIdentifier.md) interface -- the contract every format identifier class implements
- [HexSFI](/tB/Packages/Contributed/Fmt/HexSFI.md) class -- hexadecimal digits, padded with zeros
- [GeneralNumericSFI](/tB/Packages/Contributed/Fmt/GeneralNumericSFI.md) class -- the **G** identifier, which uses this class for integers
- [StringFormat](/tB/Packages/Contributed/Fmt/PublicEntryPoints/StringFormat.md) function -- formats a string using the identifiers
- [Fmt package](/tB/Packages/Contributed/Fmt/index.md) -- overview, with the table of identifiers
