RESTinio
Loading...
Searching...
No Matches
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
17namespace restinio
18{
19
20namespace string_algo
21{
22
23[[nodiscard]]
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]]
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 */
bool ends_with(const string_view_t &where, const string_view_t &what) noexcept
bool starts_with(const string_view_t &where, const string_view_t &what) noexcept