Skip to content
forked from ekg/split

split and join for C++ strings

Notifications You must be signed in to change notification settings

ashenone0917/split

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

split++: splits and join strings from C++

author: Erik Garrison <[email protected]>


overview:

split++ provides just the most useful string manipulation functions which C++
never had-- split and join-- in the form of two easily-manageable header files.


provided functions:

split.h:

// split a string on a single delimiter character (delim)
std::vector<std::string>& split(const std::string &s, char delim, std::vector<std::string> &elems);
std::vector<std::string>  split(const std::string &s, char delim);

// split a string on any character found in the string of delimiters (delims)
std::vector<std::string>& split(const std::string &s, const std::string& delims, std::vector<std::string> &elems);
std::vector<std::string>  split(const std::string &s, const std::string& delims);

join.h:

// join a vector of elements by a delimiter object.  ostream<< must be defined
// for both class S and T and an ostream, as it is e.g. in the case of strings
// and character arrays
template<class S, class T>
std::string join(S& delim, std::vector<T>& elems);


usage:

See splittest.cpp and jointest.cpp for example usage.  To use, simply include
split.h or join.h in your C++ project.

About

split and join for C++ strings

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 52.3%
  • C 47.7%