C++ multiline string literal

Well … Sort of. The easiest is to just use the fact that adjacent string literals are concatenated by the compiler: The indentation doesn’t matter, since it’s not inside the quotes. You can also do this, as long as you take care to escape the embedded newline. Failure to do so, like my first answer … Read more

Difference between string object and string literal

When you use a string literal the string can be interned, but when you use new String(“…”) you get a new string object. In this example both string literals refer the same object: Here, 2 different objects are created and they have different references: In general, you should use the string literal notation when possible. It is easier … Read more

Windows path in Python

you can use always: this works both in linux and windows. Other posibility is if you have problems with some names you can also try raw string literals: however best practice is to use the os.path module functions that always select the correct configuration for your OS: From python 3.4 you can also use the … Read more

Insert text with single quotes in PostgreSQL

String literals Escaping single quotes ‘ by doubling them up -> ” is the standard way and works of course: Plain single quotes (ASCII / UTF-8 code 39), mind you, not backticks `, which have no special purpose in Postgres (unlike certain other RDBMS) and not double-quotes “, used for identifiers. In old versions or if you still run with standard_conforming_strings = … Read more