Skip to content

Support thousands separator #83

@Krzmbrzl

Description

@Krzmbrzl

I know the docs say

the ' printf option (format with thousands grouping characters)) has no effect in format.

and the code says

case '\'':
break; // no effect yet. (painful to implement)

but it would be really neat if this could be supported in the future.

I assume the issue is that Boost::format is essentially trying to achieve all (or at least the majority) of its formatting using standard stream flags and there is none for thousands separators?

From https://stackoverflow.com/questions/17530408/print-integer-with-thousands-and-millions-separator it seems that what would be necessary is to use a imbue in combination with a locale.
Has this been considered yet?

EDIT: This approach seems to at least break when using Boost::multiprecision numbers with the stream at which case the thousands separator is ignored again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions