Files
dbc/core/text_utils.h
T
2026-10-07 18:50:11 -04:00

24 lines
584 B
C++

#ifndef DBC_TEXT_UTILS_H
#define DBC_TEXT_UTILS_H
#include <cctype>
#include <string>
namespace dbc_detail {
inline std::string TrimText(const std::string &text) {
std::string::size_type begin = 0U;
while ((begin < text.size()) &&
std::isspace(static_cast<unsigned char>(text[begin])))
++begin;
std::string::size_type end = text.size();
while ((end > begin) &&
std::isspace(static_cast<unsigned char>(text[end - 1U])))
--end;
return text.substr(begin, end - begin);
}
}
#endif