tetl 0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
str_replace.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: BSL-1.0
2// SPDX-FileCopyrightText: Copyright (C) 2021 Tobias Hienzsch
3
4#ifndef TETL_STRING_STR_REPLACE_HPP
5#define TETL_STRING_STR_REPLACE_HPP
6
7namespace etl::detail {
8
9template <typename CharT>
10constexpr auto str_replace(CharT* f, CharT* l, CharT ch) -> void
11{
12 for (; f != l; ++f) {
13 *f = ch;
14 }
15}
16
17template <typename CharT>
18constexpr auto str_replace(CharT* f, CharT* l, CharT const* sf, CharT const* sl) -> void
19{
20 for (; (f != l) && (sf != sl); ++f, ++sf) {
21 *f = *sf;
22 }
23}
24} // namespace etl::detail
25
26#endif // TETL_STRING_STR_REPLACE_HPP
Definition adjacent_find.hpp:9