mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2026-01-06 09:12:54 -08:00
include the otel header-only part directly for ease of use
This commit is contained in:
parent
8895ad182f
commit
7f835b414a
241 changed files with 49967 additions and 3 deletions
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright The OpenTelemetry Authors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "opentelemetry/nostd/string_view.h"
|
||||
#include "opentelemetry/version.h"
|
||||
|
||||
OPENTELEMETRY_BEGIN_NAMESPACE
|
||||
namespace common
|
||||
{
|
||||
|
||||
class StringUtil
|
||||
{
|
||||
public:
|
||||
static nostd::string_view Trim(nostd::string_view str, size_t left, size_t right) noexcept
|
||||
{
|
||||
while (left <= right && isspace(str[left]))
|
||||
{
|
||||
left++;
|
||||
}
|
||||
while (left <= right && isspace(str[right]))
|
||||
{
|
||||
right--;
|
||||
}
|
||||
return str.substr(left, 1 + right - left);
|
||||
}
|
||||
|
||||
static nostd::string_view Trim(nostd::string_view str) noexcept
|
||||
{
|
||||
if (str.empty())
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
||||
return Trim(str, 0, str.size() - 1);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace common
|
||||
|
||||
OPENTELEMETRY_END_NAMESPACE
|
||||
Loading…
Add table
Add a link
Reference in a new issue