RESTinio
Loading...
Searching...
No Matches
restinio
helpers
string_algo.hpp
Go to the documentation of this file.
1
/*
2
* RESTinio
3
*/
4
5
/*!
6
* @file
7
* @brief Various string-related algorithms.
8
*
9
* @since v.0.6.1
10
*/
11
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
[[
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
[[
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 */
restinio::string_algo
Definition
string_algo.hpp:21
restinio::string_algo::ends_with
bool ends_with(const string_view_t &where, const string_view_t &what) noexcept
Definition
string_algo.hpp:33
restinio::string_algo::starts_with
bool starts_with(const string_view_t &where, const string_view_t &what) noexcept
Definition
string_algo.hpp:24
restinio
Definition
sendfile_operation_default.ipp:12
Generated by
1.14.0