Step 167: split EditorState into sub-states
This commit is contained in:
11
editor/src/StringUtils.h
Normal file
11
editor/src/StringUtils.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user