Code Search for Developers
 
 
  

split.cc from AlphaMail at Krugle


Show split.cc syntax highlighted

#include <string>
#include <vector>
#include <iostream>

using std::cout;
using std::endl;

bool split_args(const std::string &s, 
                std::vector<std::string> *args)
{
   int pos, npos;

   pos = 0;
   while(pos < s.length()) {
      npos = s.find_first_of(' ', pos);
      args->push_back(s.substr(pos, npos-pos));
      pos = s.find_first_not_of(' ', npos);
   }

   return true;
}

int main()
{
   std::string a("this is    a       test");
   std::string b("This  is another   test");
   std::vector<std::string> args;
   std::vector<std::string>::iterator i;

   args.clear();
   split_args(a, &args);
   cout << "Args from a:" << endl;
   for(i=args.begin(); i!=args.end(); i++)
      cout << "\t-->" << *i << "<--" << endl;

   args.clear();
   split_args(b, &args);
   cout << "Args from b:" << endl;
   for(i=args.begin(); i!=args.end(); i++)
      cout << "\t-->" << *i << "<--" << endl;

   return 0;
}




See more files for this project here

AlphaMail

AlphaMail is an accelerated web mail interface with a C++ middleware layer that is more effective than an IMAP proxy which is a highly scalable (10k+ users). The interface includes modern features, Section 508 compliance, and universal browser support.

Project homepage: http://sourceforge.net/projects/alphamail
Programming language(s): C++,Java,JavaScript,Perl
License: other

  jcorba/
    IMAPClient.java
    IMAPServer.java
    imap.idl
  Makefile
  cache_entry.cc
  client_socket.cc
  date_time.cc
  imaps_test.cc
  map_test.cc
  memory_bug.cc
  mkdir.cc
  mm.cc
  oop.cc
  parse_response.cc
  regex1.cc
  request_processor.cc
  server_socket.cc
  split.cc
  ssl.c
  ssl_client.cpp