Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
string.h
1#pragma once
2#include "gaia/config/config.h"
3
4#include "gaia/core/span.h"
5
6namespace gaia {
7 namespace core {
8 inline bool is_whitespace(char c) {
9 return c == ' ' || (c >= '\t' && c <= '\r');
10 }
11
12 inline auto trim(std::span<const char> expr) {
13 if (expr.empty())
14 return std::span<const char>{};
15
16 uint32_t beg = 0;
17 while (is_whitespace(expr[beg]))
18 ++beg;
19 uint32_t end = (uint32_t)expr.size() - 1;
20 while (end > beg && is_whitespace(expr[end]))
21 --end;
22 return expr.subspan(beg, end - beg + 1);
23 }
24 } // namespace core
25} // namespace gaia
Definition span_impl.h:99
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9