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
3#ifndef TETL_STRING_STR_REPLACE_HPP
4#define TETL_STRING_STR_REPLACE_HPP
5
6namespace etl::detail {
7
8template <typename CharT>
9constexpr auto str_replace(CharT* f, CharT* l, CharT ch) -> void
10{
11 for (; f != l; ++f) {
12 *f = ch;
13 }
14}
15
16template <typename CharT>
17constexpr auto str_replace(CharT* f, CharT* l, CharT const* sf, CharT const* sl) -> void
18{
19 for (; (f != l) && (sf != sl); ++f, ++sf) {
20 *f = *sf;
21 }
22}
23} // namespace etl::detail
24
25#endif // TETL_STRING_STR_REPLACE_HPP