How to split a string in C++?

How to split a long string to substrings?

  • split AAAABBBBAAAA....into AAAA BBBB AAAA ....

  • Answer:

    string alpha="AAAABBBBAAAA" string one=alpha.substring(0,4) string b=alpha.substring(4,4) string three=alpha.substring(8,4) i hav used substring which is valid in java,c,c++,visual basic,c#.

wx1957 at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

Visual Basic a = "AAAABBBBAAAA" g1 = left(a,4) g2 = mid(a,5,4) g3 = right(a,4) g1 will equal "AAAA" g2 will equal "BBBB" g3 will equal "AAAA"

bred2bbroken

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.