computer






 

Question by  tawillers (22)

What is an example of how to split a simple C++ string?

 
+6

Answer by  Jaggers (1018)

This is a fairly common program mod if you are in Unix spread sheet application. Using the beta factor like a pair of scissors snip between the plus signs.

 
+5

Answer by  tanay (10)

Use std::vectorstd::string" types as second parameter (ContainerT)but list is way faster than vector for when direct access is not needed, you can create your own string class and use something like "std::listSubString" where SubString does not do any copies for speed. It allows you to specify whether to trim empty tokens. it needs is stdstring.

 
+4

Answer by  gigo (1706)

The classic function to split a string is to use the function strtok. You can find the corresponding example on the page cplusplus. com by searching for the term.

 
+4

Answer by  pri (12)

using namespace std; int main() { string myString("My name is pri"); istringstream iss(myString); do { string output; iss >> output; cout

 
You have 50 words left!