poco icon indicating copy to clipboard operation
poco copied to clipboard

Poco::format() doesn't support (space) as a flag like printf() does

Open austin-beer opened this issue 6 years ago • 12 comments

printf() supports a space ' ' as a flag in the format specifier. It would be great if Poco::format() supported the same.

http://www.cplusplus.com/reference/cstdio/printf/ https://github.com/pocoproject/poco/blob/1bf40a0cd28be83e6243a0524be19118792c8cd1/Foundation/src/Format.cpp#L30

austin-beer avatar Jun 21 '19 18:06 austin-beer

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jan 12 '22 02:01 github-actions[bot]

This issue has been open for over two and a half years. Is there any chance of addressing this issue?

austin-beer avatar Jan 12 '22 16:01 austin-beer

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jan 13 '23 03:01 github-actions[bot]

This issue has been open for over three years? Would it be possible for someone to address this issue?

austin-beer avatar Jan 17 '23 16:01 austin-beer

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Jan 19 '24 02:01 github-actions[bot]

@austin-beer, is this stil an issue in Poco 1.13?

If so, can you prepare a fix and create a pull request?

matejk avatar Jan 19 '24 13:01 matejk

Yes, this is still an issue in Poco 1.13. This switch statement still doesn't handle a space character in the format string: https://github.com/pocoproject/poco/blob/poco-1.13.0-release/Foundation/src/Format.cpp#L35

Unfortunately I don't have time right now to develop a fix for this, but I'll put it on my TODO list to work on if I get time.

austin-beer avatar Jan 19 '24 14:01 austin-beer

Poco::format wraps the C++ streams which don't have an equivalent for this flag. That makes this a pretty difficult feature to implement in Poco. Simply adding a space to that switch isn't going to cut it.

andrewauclair avatar Feb 19 '24 15:02 andrewauclair

Ah, yes, I didn't realize that. It does make implementing this capability more difficult. Perhaps instead then an exception should be thrown if ' ' is encountered as a format flag so that the un-expected behavior (that it's not supported) is clear to anyone who tries to use it.

austin-beer avatar Feb 20 '24 14:02 austin-beer