9 #ifndef _LOG4SHIB_STRINGUTIL_HH
10 #define _LOG4SHIB_STRINGUTIL_HH
29 static std::string
vform(
const char* format, va_list args);
35 static std::string
trim(
const std::string& s);
50 static unsigned int split(std::vector<std::string>& v,
51 const std::string& s,
char delimiter,
52 unsigned int maxSegments = INT_MAX);
63 template<
typename T>
static unsigned int split(T& output,
64 const std::string& s,
char delimiter,
65 unsigned int maxSegments = INT_MAX) {
66 std::string::size_type left = 0;
68 for(i = 1; i < maxSegments; i++) {
69 std::string::size_type right = s.find(delimiter, left);
70 if (right == std::string::npos) {
73 *output++ = s.substr(left, right - left);
77 *output++ = s.substr(left);
83 #endif // _LOG4SHIB_STRINGUTIL_HH