DBC Framework
DBC parsing and CAN signal decoding framework
Loading...
Searching...
No Matches
text_utils.h
1#ifndef DBC_TEXT_UTILS_H
2#define DBC_TEXT_UTILS_H
3
4#include <cctype>
5#include <string>
6
7namespace dbc_detail {
8 inline std::string TrimText(const std::string &text) {
9 std::string::size_type begin = 0U;
10 while ((begin < text.size()) &&
11 std::isspace(static_cast<unsigned char>(text[begin])))
12 ++begin;
13
14 std::string::size_type end = text.size();
15 while ((end > begin) &&
16 std::isspace(static_cast<unsigned char>(text[end - 1U])))
17 --end;
18
19 return text.substr(begin, end - begin);
20 }
21}
22
23#endif