It's 2023 and I think it's silly that an identifier for a string is something that is found so commonly in text, and as well in other languages like markup.
C++ uses the "
symbol to denote the beginning and end of a string.
Is there a way to have this symbol be something else?
For example \xac
, which is also a 1-byte character.
As an example, if the string identifier were something other than a double-quote, then using the system()
function would be a lot easier to use, where double-quotes would come in quite handy.
This goes for something like PHP as well. I use echo '<div class="adiv"></div>'
with single-quotes so that I can write something inside with double-quotes, but sometimes I need to be able to use both double and single quotes.
Are we really limited to quotes and double-quote being our delimiters? Can't we use, or set, a custom character that doesn't appear elsewhere?
If it's doable, please tell me how. If it's a pipe dream, let me know as well.
//Example: (I know the character I'm about to use is 3-bytes (\xe2\x81\x91) but just for demonstration...
#include <iostream>
int main() {
std::cout << ⁑Hello world!\n⁑;
system(⁑echo -e '"hello\nworld"' | grep 'hello' | sed s/'"hello'/'"Hello!"'/⁑);
return 0;
}
I tried searching many pages (paginations?) of Google, and I can't even find anyone who asked the question.