Enzo
Loading...
Searching...
No Matches
StringUtils.h
1#pragma once
2#include <cctype>
3#include <string_view>
4
5namespace enzo::utils {
6
10inline std::string_view trim(std::string_view text)
11{
12 size_t start = 0;
13 while (start < text.size() && std::isspace(static_cast<unsigned char>(text[start])))
14 ++start;
15 size_t end = text.size();
16 while (end > start && std::isspace(static_cast<unsigned char>(text[end - 1])))
17 --end;
18 return text.substr(start, end - start);
19}
20
21} // namespace enzo::utils