Skip to content

Commit b2b6ce3

Browse files
committed
Add info about POSIX extension for positional arguments
1 parent 6f19b2d commit b2b6ce3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ of the type of `s`, tinyformat might be for you. Design goals include:
88

99
* Type safety and extensibility for user defined types.
1010
* C99 `printf()` compatibility, to the extent possible using `std::ostream`
11+
* POSIX extension for positional arguments
1112
* Simplicity and minimalism. A single header file to include and distribute
1213
with your projects.
1314
* Augment rather than replace the standard stream formatting mechanism
@@ -31,6 +32,16 @@ int min = 44;
3132
tfm::printf("%s, %s %d, %.2d:%.2d\n", weekday, month, day, hour, min);
3233
```
3334
35+
POSIX extension for positional arguments is available.
36+
The ability to rearrange formatting arguments is an important feature
37+
for localization because the word order may vary in different languages.
38+
39+
Previous example for German usage. Arguments are reordered:
40+
41+
```C++
42+
tfm::printf("%1$s, %3$d. %2$s, %4$d:%5$.2d\n", weekday, month, day, hour, min);
43+
```
44+
3445
The strange types here emphasize the type safety of the interface, for example
3546
it is possible to print a `std::string` using the `"%s"` conversion, and a
3647
`size_t` using the `"%d"` conversion. A similar result could be achieved

0 commit comments

Comments
 (0)