What does {0} mean when found in a string in C#?

You are printing a formatted string. The {0} means to insert the first parameter following the format string; in this case the value associated with the key “rtf”. For String.Format, which is similar, if you had something like you’d create a string “This is a test. The value is 42“. You can also use expressions, and print … Read more

Split a string into an array in C++

By the way, use qualified-names such as std::getline, std::ifstream like I did. It seems you’ve written using namespace std somewhere in your code which is considered a bad practice. So don’t do that: Why is “using namespace std” considered bad practice?

Return char[]/string from a function

Notice you’re not dynamically allocating the variable, which pretty much means the data inside str, in your function, will be lost by the end of the function. You should have: Then, when you call the function, the type of the variable that will receive the data must match that of the function return. So, you should … Read more

Insert some string into given string at given index in Python

An important point that often bites new Python programmers but the other posters haven’t made explicit is that strings in Python are immutable — you can’t ever modify them in place. You need to retrain yourself when working with strings in Python so that instead of thinking, “How can I modify this string?” instead you’re thinking “how … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)