fix(string) Trim error
Some checks failed
android / build (push) Waiting to run
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Waiting to run
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Waiting to run
linux-arm-gcc / linux-gcc-arm (Debug) (push) Waiting to run
linux-arm-gcc / linux-gcc-arm (Release) (push) Waiting to run
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Waiting to run
linux-arm-gcc / linux-gcc-armhf (Release) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Waiting to run
linux-x64-clang / linux-clang (Debug) (push) Waiting to run
linux-x64-clang / linux-clang (Release) (push) Waiting to run
linux-x64-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x64-gcc / linux-gcc (Release) (push) Waiting to run
linux-x86-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x86-gcc / linux-gcc (Release) (push) Waiting to run
android / build (pull_request) Failing after 5s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (pull_request) Failing after 4s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (pull_request) Failing after 5s
linux-arm-gcc / linux-gcc-arm (Debug) (pull_request) Failing after 5s
linux-arm-gcc / linux-gcc-arm (Release) (pull_request) Failing after 4s
linux-arm-gcc / linux-gcc-armhf (Debug) (pull_request) Failing after 9s
linux-arm-gcc / linux-gcc-armhf (Release) (pull_request) Failing after 9s
linux-mips-gcc / linux-gcc-mipsel (Debug) (pull_request) Failing after 4s
linux-mips-gcc / linux-gcc-mipsel (Release) (pull_request) Failing after 5s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (pull_request) Failing after 5s
linux-mips64-gcc / linux-gcc-mips64el (Release) (pull_request) Failing after 5s
linux-x64-clang / linux-clang (Debug) (pull_request) Failing after 11s
linux-x64-clang / linux-clang (Release) (pull_request) Failing after 7s
linux-x64-gcc / linux-gcc (Debug) (pull_request) Failing after 5s
linux-x64-gcc / linux-gcc (Release) (pull_request) Failing after 6s
linux-x86-gcc / linux-gcc (Debug) (pull_request) Failing after 5s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (pull_request) Failing after 14m20s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (pull_request) Failing after 14m15s
linux-x86-gcc / linux-gcc (Release) (pull_request) Failing after 13m29s
Some checks failed
android / build (push) Waiting to run
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Waiting to run
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Waiting to run
linux-arm-gcc / linux-gcc-arm (Debug) (push) Waiting to run
linux-arm-gcc / linux-gcc-arm (Release) (push) Waiting to run
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Waiting to run
linux-arm-gcc / linux-gcc-armhf (Release) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Waiting to run
linux-x64-clang / linux-clang (Debug) (push) Waiting to run
linux-x64-clang / linux-clang (Release) (push) Waiting to run
linux-x64-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x64-gcc / linux-gcc (Release) (push) Waiting to run
linux-x86-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x86-gcc / linux-gcc (Release) (push) Waiting to run
android / build (pull_request) Failing after 5s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (pull_request) Failing after 4s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (pull_request) Failing after 5s
linux-arm-gcc / linux-gcc-arm (Debug) (pull_request) Failing after 5s
linux-arm-gcc / linux-gcc-arm (Release) (pull_request) Failing after 4s
linux-arm-gcc / linux-gcc-armhf (Debug) (pull_request) Failing after 9s
linux-arm-gcc / linux-gcc-armhf (Release) (pull_request) Failing after 9s
linux-mips-gcc / linux-gcc-mipsel (Debug) (pull_request) Failing after 4s
linux-mips-gcc / linux-gcc-mipsel (Release) (pull_request) Failing after 5s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (pull_request) Failing after 5s
linux-mips64-gcc / linux-gcc-mips64el (Release) (pull_request) Failing after 5s
linux-x64-clang / linux-clang (Debug) (pull_request) Failing after 11s
linux-x64-clang / linux-clang (Release) (pull_request) Failing after 7s
linux-x64-gcc / linux-gcc (Debug) (pull_request) Failing after 5s
linux-x64-gcc / linux-gcc (Release) (pull_request) Failing after 6s
linux-x86-gcc / linux-gcc (Debug) (pull_request) Failing after 5s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (pull_request) Failing after 14m20s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (pull_request) Failing after 14m15s
linux-x86-gcc / linux-gcc (Release) (pull_request) Failing after 13m29s
This commit is contained in:
parent
eda5a20286
commit
729ee8b86c
@ -75,11 +75,11 @@ include(cmake/BuildInfo.cmake)
|
||||
check_symbol_exists("getifaddrs" "ifaddrs.h" TILE_HAVE_GETIFADDRS)
|
||||
check_symbol_exists("freeifaddrs" "ifaddrs.h" TILE_HAVE_FREEIFADDRS)
|
||||
|
||||
find_package(Git REQUIRED)
|
||||
|
||||
get_git_commit_hash(GIT_COMMIT_HASH)
|
||||
get_git_commit_date(GIT_COMMIT_DATE)
|
||||
get_git_commit_subject(GIT_COMMIT_SUBJECT)
|
||||
# find_package(Git REQUIRED)
|
||||
#
|
||||
# get_git_commit_hash(GIT_COMMIT_HASH)
|
||||
# get_git_commit_date(GIT_COMMIT_DATE)
|
||||
# get_git_commit_subject(GIT_COMMIT_SUBJECT)
|
||||
|
||||
set(THIRD_PARTY_INCLUDE_DIRS
|
||||
# "third_party/json" "third_party/inja"
|
||||
|
@ -139,26 +139,6 @@ Trim(Slice s, Slice cutset)
|
||||
return Trim(s, [&cutset](char c) { return cutset.find(Slice(&c, 1)) != Slice::npos; });
|
||||
}
|
||||
|
||||
Slice
|
||||
TrimLeft(Slice s, std::function<bool(char)> pred)
|
||||
{
|
||||
while (!s.empty() && pred(s[0])) { s.RemovePrefix(1); }
|
||||
return s;
|
||||
}
|
||||
|
||||
Slice
|
||||
TrimRight(Slice s, std::function<bool(char)> pred)
|
||||
{
|
||||
while (!s.empty() && pred(s[s.size() - 1])) { s.RemoveSuffix(1); }
|
||||
return s;
|
||||
}
|
||||
|
||||
Slice
|
||||
Trim(Slice s, std::function<bool(char)> pred)
|
||||
{
|
||||
return TrimRight(TrimLeft(s, pred), pred);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
JoinImpl(const T &parts, Slice delim, std::string *result)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "tile/base/optional.h"
|
||||
#include "tile/base/slice.h"
|
||||
|
||||
#include <cctype>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -41,9 +42,29 @@ std::string Replace(Slice str, Slice from, Slice to, std::size_t count = std::nu
|
||||
Slice TrimLeft(Slice s, Slice cutset);
|
||||
Slice TrimRight(Slice s, Slice cutset);
|
||||
Slice Trim(Slice s, Slice cutset);
|
||||
Slice TrimLeft(Slice s, std::function<bool(char)> pred = isspace);
|
||||
Slice TrimRight(Slice s, std::function<bool(char)> pred = isspace);
|
||||
Slice Trim(Slice s, std::function<bool(char)> pred = isspace);
|
||||
|
||||
template<typename Pred = decltype(isspace)>
|
||||
Slice
|
||||
TrimLeft(Slice s, Pred pred = isspace)
|
||||
{
|
||||
while (!s.empty() && pred(s[0])) { s.RemovePrefix(1); }
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename Pred = decltype(isspace)>
|
||||
Slice
|
||||
TrimRight(Slice s, Pred pred = isspace)
|
||||
{
|
||||
while (!s.empty() && pred(s[s.size() - 1])) { s.RemoveSuffix(1); }
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename Pred = decltype(isspace)>
|
||||
Slice
|
||||
Trim(Slice s, Pred pred = isspace)
|
||||
{
|
||||
return TrimRight(TrimLeft(s, pred), pred);
|
||||
}
|
||||
|
||||
std::vector<Slice> Split(Slice s,
|
||||
char delim,
|
||||
|
Loading…
x
Reference in New Issue
Block a user