Evgeny Safronov ede39aeb33
feat: reinterpret precision field for strings
This commit changes the behavior of formatting string arguments
with both width and precision fields set.

Documentation says that the `width` field is the "minimum width"
that the format should take up. If the value's string does not
fill up this many characters, then the padding specified by
fill/alignment will be used to take up the required space.

This is true for all formatted types except string, which is truncated
down to `precision` number of chars and then all of `fill`, `align` and
`width` fields are completely ignored.

For example: `format!("{:/^10.8}", "1234567890);` emits "12345678".
In the contrast Python version works as the expected:
```python
>>> '{:/^10.8}'.format('1234567890')
'/12345678/'
```

This commit gives back the `Python` behavior by changing the `precision`
field meaning to the truncation and nothing more. The result string *will*
be prepended/appended up to the `width` field with the proper `fill` char.

However, this is the breaking change.

Also updated `std::fmt` docs about string precision.

Signed-off-by: Evgeny Safronov <division494@gmail.com>
2016-07-06 00:01:14 +03:00
..
2016-06-27 18:30:46 +00:00
2016-06-27 18:30:46 +00:00
2016-06-27 18:30:46 +00:00
2016-06-27 18:30:46 +00:00
2016-06-27 18:30:46 +00:00
2016-06-27 23:40:04 +00:00