# std: Respect user-specified alignment when formatting ints · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/27adb82fda516e95c3c03df80a95b895969fdd56)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 27adb82fda516e95c3c03df80a95b895969fdd56

Requested commit: 27adb82fda516e95c3c03df80a95b895969fdd56

Commit: 27adb82fda516e95c3c03df80a95b895969fdd56

Tree: d906389a448b260b4c64bf101fab822944ed4105

Author: LemonBoy

Committer: LemonBoy

## Message

```
std: Respect user-specified alignment when formatting ints

This implementation tries to do the right thing (TM) by treating the
sign as part of the number itself, therefore the alignment parameter
applies to both the sign and the digits.

In other words the format string `{:>4}` with -1 as input will not
output `-  1` but `  -1`.

And let's default to right alignment for everything as that's what users
want, especially when printing numbers. Many implementations use
different defaults for numeric vs non-numeric types, let's strive for a
consistent behaviour here.

```

## Parents

- [bb9a4ad6e903ad2f9c137bca56bdf2dd6fc65d03](https://git.cafe/gitcafe/zig/commit/bb9a4ad6e903ad2f9c137bca56bdf2dd6fc65d03?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/27adb82fda516e95c3c03df80a95b895969fdd56?format=markdown)
