mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
22 lines
378 B
C++
22 lines
378 B
C++
#include "pch.h"
|
|
#include "StrUtils.h"
|
|
|
|
|
|
void StrUtils::Trim(std::string_view& str) {
|
|
for (int i = 0; i < str.size(); ++i) {
|
|
if (!isspace(str[i])) {
|
|
str.remove_prefix(i);
|
|
|
|
size_t i = str.size() - 1;
|
|
for (; i > 0; --i) {
|
|
if (!isspace(str[i])) {
|
|
break;
|
|
}
|
|
}
|
|
str.remove_suffix(str.size() - 1 - i);
|
|
return;
|
|
}
|
|
}
|
|
|
|
str.remove_prefix(str.size());
|
|
}
|