25 #ifndef __I6ENGINE_UTILS_I6ESTRING_H__
26 #define __I6ENGINE_UTILS_I6ESTRING_H__
42 inline std::vector<std::string>
split(
const std::string & str,
const std::string & delim) {
43 std::vector<std::string> ret;
46 size_t n2 = str.find(delim);
48 while (n2 != std::string::npos) {
49 std::string s = str.substr(n, n2 - n);
51 n2 = str.find(delim, n);
58 if (str.size() - n > 0) {
59 ret.push_back(str.substr(n, str.size() - n));
69 typename std::enable_if<std::is_floating_point<T>::value, std::string>::type
to_string_with_precision(
const T a_value,
const int n) {
70 std::ostringstream out;
71 out << std::setprecision(n) << a_value;
std::vector< std::string > split(const std::string &str, const std::string &delim)
returns a vector of strings separated by the given delimitter e.g. a;b;c with delimitter ; will retur...
std::enable_if< std::is_floating_point< T >::value, std::string >::type to_string_with_precision(const T a_value, const int n)
returns a string from a floating point value with given precision