Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there an option to quote std::string (e.g., [" ", ""] instead of [ , ])? #16

Open
philipp-classen opened this issue Dec 21, 2014 · 1 comment

Comments

@philipp-classen
Copy link

First, thank you, the cxx-prettyprint library is really great. However, I wanted the strings in my output to be quoted, especially non-trimmed strings are otherwise hard to understand.

Example: [" ", ""] instead of [ , ]

I'm not sure if it is possible to customize it with the existing template specializations, so I made some minor modification:
https://github.com/philipp-classen/cxx-prettyprint

The patch is good enough to solve my specific use case, however, if the option to quote string proves to be useful for others, I would expect there is a better way to implement it. So, no pull request but a prove of concept if others are interested.

@ericcurtin
Copy link

ericcurtin commented Apr 3, 2018

Decent idea... One step further would be single quotes for values stored as a single char

Only thing is it would be unlike cout and ostringstream's default behaviour for strings, leaving out the quotes. But it kinda makes sense when printing the full contents of an STL container.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants