tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
strrchr.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2020 Tobias Hienzsch
3
4#ifndef TETL_CSTRING_STRRCHR_HPP
5#define TETL_CSTRING_STRRCHR_HPP
6
7#include <etl/_cstddef/size_t.hpp>
8#include <etl/_strings/cstr.hpp>
9
10namespace etl {
11
12/// \ingroup cstring
13/// @{
14
15/// Finds the last occurrence of the character static_cast<char>(ch) in
16/// the byte string pointed to by str.
17///
18/// The terminating null character is considered to be a part of the
19/// string and can be found if searching for '\0'.
20///
21/// https://en.cppreference.com/w/cpp/string/byte/strrchr
22///
23/// \ingroup cstring
24[[nodiscard]] constexpr auto strrchr(char const* str, int ch) noexcept -> char const*
25{
26 return etl::detail::strrchr<char const, etl::size_t>(str, ch);
27}
28
29[[nodiscard]] constexpr auto strrchr(char* str, int ch) noexcept -> char*
30{
31 return etl::detail::strrchr<char, etl::size_t>(str, ch);
32}
33
34/// @}
35
36} // namespace etl
37
38#endif // TETL_CSTRING_STRRCHR_HPP
constexpr auto strrchr(char const *str, int ch) noexcept -> char const *
Definition strrchr.hpp:24
constexpr auto strrchr(char *str, int ch) noexcept -> char *
Definition strrchr.hpp:29
Definition adjacent_find.hpp:9