12 lines
354 B
C++
12 lines
354 B
C++
#pragma once
|
|
#include <string>
|
|
#include <cctype>
|
|
|
|
static inline std::string trimCopy(const std::string& s) {
|
|
size_t start = 0;
|
|
while (start < s.size() && std::isspace((unsigned char)s[start])) ++start;
|
|
size_t end = s.size();
|
|
while (end > start && std::isspace((unsigned char)s[end - 1])) --end;
|
|
return s.substr(start, end - start);
|
|
}
|