-std::vector<std::string> split(const std::string &, const std::string & =" \t\r\n", bool =false);
-std::vector<std::string> split(const std::string &, char, bool =false);
-template<typename T>
-std::string join(const T &, const std::string & =" ");
+
+/**
+Splits a string at occurrences of any of the characters in sep. If max_split
+is non-negative, at most that many split will be performed, i.e. the resulting
+vector will contain at most max_split+1 elements. Two or more consecutive
+separator characters will be treated as a single separator.
+
+@param str A string
+@param sep Separator characters
+@param max_split Maximum number of splits to perform
+*/
+std::vector<std::string> split(const std::string &str, const std::string &sep=" \t\r\n", int max_split=-1);
+
+/**
+Splits a string on occurrences of a single character.
+*/
+std::vector<std::string> split(const std::string &str, char sep, int max_split=-1);
+
+/**
+Splits a string on occurrences of another string.
+*/
+std::vector<std::string> split_long(const std::string &str, const std::string &sep, int max_split=-1);
+
+/**
+Splits a string on occurrences of another string. Two consecutive separators
+will cause an empty string to be placed in the result.
+*/
+std::vector<std::string> split_fields(const std::string &str, const std::string &sep, int max_split=-1);
+
+/**
+Splits a string on occurrences of a single character. Two consecutive
+separators will cause an empty string to be placed in the result.
+*/
+std::vector<std::string> split_fields(const std::string &str, char sep, int max_split=-1);
+
+/**
+Concatenates strings from an iterator range.
+
+@param begin First iterator
+@param end Last iterator
+@param sep Separator to be inserted between strings
+*/
+template<typename Iter>
+std::string join(Iter begin, Iter end, const std::string &sep=" ")
+{
+ std::string result;
+ for(Iter i=begin; i!=end; ++i)
+ {
+ if(i!=begin)
+ result+=sep;
+ result+=*i;
+ }
+
+ return result;
+}
+
+/**
+Strips leading and trailing whitespace from a string.
+*/