| 41 | // Join a list of data with fixed precision separated by delimiter. |
| 42 | template <typename T> |
| 43 | string Join(T* data, size_t len, const string& delimiter) { |
| 44 | if (len == 0 || data == nullptr) { |
| 45 | return ""; |
| 46 | } |
| 47 | std::stringstream result; |
| 48 | result << std::setprecision(9) << data[0]; |
| 49 | for (int i = 1; i < len; i++) { |
| 50 | result << std::setprecision(9) << delimiter << data[i]; |
| 51 | } |
| 52 | return result.str(); |
| 53 | } |
| 54 | |
| 55 | // Join a list of uint8 data separated by a delimiter. Cast data to int before |
| 56 | // placing it in the string to prevent values from being treated like chars. |
no outgoing calls