RESTinio
restinio
helpers
string_algo.hpp
Go to the documentation of this file.
1
/*
2
* RESTinio
3
*/
4
12
#pragma once
13
14
#include <
restinio/string_view.hpp
>
15
#include <
restinio/compiler_features.hpp
>
16
17
namespace
restinio
18
{
19
20
namespace
string_algo
21
{
22
23
RESTINIO_NODISCARD
24
bool
starts_with
(
25
const
string_view_t
& where,
26
const
string_view_t
& what ) noexcept
27
{
28
return
where.size() >= what.size() &&
29
0 == where.compare(0u, what.size(), what);
30
}
31
32
RESTINIO_NODISCARD
33
bool
ends_with
(
34
const
string_view_t
& where,
35
const
string_view_t
& what ) noexcept
36
{
37
return
where.size() >= what.size() && 0 == where.compare(
38
where.size() - what.size(), what.size(), what);
39
}
40
41
}
/* namespace string_algo */
42
43
}
/* namespace restinio */
44
RESTINIO_NODISCARD
#define RESTINIO_NODISCARD
Definition:
compiler_features.hpp:33
string_view.hpp
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::string_view_t
nonstd::string_view string_view_t
Definition:
string_view.hpp:19
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
Definition:
asio_include.hpp:21
compiler_features.hpp
Detection of compiler version and absence of various features.
Generated by
1.8.20