Switch to full style
C++ code examples
Post a reply

split string in C++

Thu Nov 13, 2008 7:25 pm

Strings split using C++
cpp code
#include <iostream>
using std::cout;
using std::endl;

#include <string>
using std::string;

int main()
{
string s1( "AA1234567890asdfasdf" );
string s2( " AAB" );
string s3;

// test string member function substr
cout << "The substring of s1 starting at location 0 for\n"
<< "14 characters, s1.substr(0, 14), is:\n"
<< s1.substr( 0, 14 ) << "\n\n";

return 0;
}

/*
The substring of s1 starting at location 0 for
14 characters, s1.substr(0, 14), is:
AA1234567890as


*/




Post a reply
  Related Posts  to : split string in C++
 String token for string split     -  
 recursive string reversal- reverse string     -  
 check if string ends with specific sub-string in php     -  
 Splitting a String Based on a Found String     -  
 check if string start with a specific sub-string in PHP     -  
 Pad a string to a certain length with another string     -  
 Append string in C++     -  
 get string size in c++     -  
 formatting string in c++     -  
 Echoing a String     -  

Topic Tags

C++ Strings