Loading...
Searching...
No Matches
string_algo.hpp
Go to the documentation of this file.
/*
* RESTinio
*/
#pragma once
#include <restinio/string_view.hpp>
#include <restinio/compiler_features.hpp>
namespace restinio
{
namespace string_algo
{
RESTINIO_NODISCARD
bool starts_with(
const string_view_t & where,
const string_view_t & what ) noexcept
{
return where.size() >= what.size() &&
0 == where.compare(0u, what.size(), what);
}
RESTINIO_NODISCARD
bool ends_with(
const string_view_t & where,
const string_view_t & what ) noexcept
{
return where.size() >= what.size() && 0 == where.compare(
where.size() - what.size(), what.size(), what);
}
} /* namespace string_algo */
} /* namespace restinio */
compiler_features.hpp
Detection of compiler version and absence of various features.
RESTINIO_NODISCARD
#define RESTINIO_NODISCARD
Definition: compiler_features.hpp:36
restinio::string_algo::ends_with
RESTINIO_NODISCARD bool ends_with(const string_view_t &where, const string_view_t &what) noexcept
Definition: string_algo.hpp:33
restinio::string_algo::starts_with
RESTINIO_NODISCARD bool starts_with(const string_view_t &where, const string_view_t &what) noexcept
Definition: string_algo.hpp:24
restinio
Definition: asio_include.hpp:21
restinio::string_view_t
nonstd::string_view string_view_t
Definition: string_view.hpp:19
string_view.hpp