mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add strJoin to utils.h
This commit is contained in:
15
src/utils.h
15
src/utils.h
@@ -2,6 +2,7 @@
|
|||||||
#define __UTILS__
|
#define __UTILS__
|
||||||
|
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
|
||||||
#define nothing() do {} while (0)
|
#define nothing() do {} while (0)
|
||||||
|
|
||||||
@@ -9,4 +10,18 @@ boost::posix_time::ptime ptEpoch();
|
|||||||
int iToSeconds(boost::posix_time::ptime ptWhen);
|
int iToSeconds(boost::posix_time::ptime ptWhen);
|
||||||
boost::posix_time::ptime ptFromSeconds(int iSeconds);
|
boost::posix_time::ptime ptFromSeconds(int iSeconds);
|
||||||
|
|
||||||
|
template<class Iterator>
|
||||||
|
std::string strJoin(Iterator first, Iterator last, std::string strSeperator)
|
||||||
|
{
|
||||||
|
std::ostringstream ossValues;
|
||||||
|
|
||||||
|
for (Iterator start = first; first != last; first++)
|
||||||
|
{
|
||||||
|
ossValues << str(boost::format("%s%s") % (start == first ? "" : strSeperator) % *first);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ossValues.str();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// vim:ts=4
|
||||||
|
|||||||
Reference in New Issue
Block a user