Closes #28
This commit is contained in:
1 parent
a0938cb29c
commit
3dd9230fca
21 files changed
+491
-450
No files matched your search
@@ -0,0 +1,23 @@
|
||||
#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
|
||||
Reference in new issue
Block a user