I want to define a constexpr function strip_string
which allows:
- Trim the string (removal of contiguous whitespaces in the beginning and end of the string.
- Normalize contiguous whitespaces in the middle of the string to one space.
- Return a
const char*
of the final size as a constant so the binary will contain the reduced string and not the original string.
The purpose is to keep a readable string in the source and have the shortest string in the binary.
I’m using Visual Studio C++ 2017.
6