string-literals

What is wrong with this boost c++ regex code???

hello #include <iostream> #include <fstream> #include <string> #include<string> #include<boost/algorithm/string.hpp> #include<boost/regex.hpp> #include <boost/algorithm/string/trim.hpp> using namespace std; using namespace boost; int main() { string robotsfile="User-Agent: *" "Disallow: /"; regex exrp( "^Disallow...

Combining string literals and integer constants

Given an compile-time constant integer (an object, not a macro), can I combine it with a string literal at compile time, possibly with the preprocessor? For example, I can concatenate string literals just by placing them adjacent to each other: bool do_stuff(std::string s); //... do_stuff("This error code is ridiculously long so I am g...

What is the difference between a String Constant and String Literal in C?

What's the difference between a String Constant and String Literal in plain C? This question is similar to another: http://stackoverflow.com/questions/25746/whats-the-difference-between-a-string-constant-and-a-string-literal ...except that one was regarding Objective-C (using NSString) and not C. ...

Does a final String inside a private static method instantiate a new object when invoked?

Does a static final String inside a private static method instantiate a new object when invoked? private static String Test() { final String foo = "string literal"; return foo; } Or does the compiler know there is only a single, string literal, inside the method? Or should I make it a private static final class field? This has...

Distinguish a string literal from a string C#

I want to do something like IsItAStringLiteral("yes") var v = "no"; IsItAStringLiteral(v) With the obvious return value. Is it possible? ...