Go to the documentation of this file.
9 #ifndef EAGINE_STRING_ALGO_HPP
10 #define EAGINE_STRING_ALGO_HPP
27 std::basic_string<C, T, A>& str,
30 std::string::size_type index = 0;
32 index = str.find(from.data(), index, from.size());
33 if(index == std::string::npos) {
36 str.replace(index, from.size(), to.data(), to.size());
53 std::basic_string<C, T, A>& str,
54 span<
const std::tuple<
57 for(
auto& [from, to] : dict) {
65 #endif // EAGINE_STRING_ALGO_HPP
Common code is placed in this namespace.
Definition: eagine.hpp:21
basic_span< T, T *, S > span
Default alias for basic memory spans with native pointer type.
Definition: span.hpp:415
Specialization of memory::basic_span for character string containers.
Definition: string_span.hpp:25
Non-owning view of a contiguous range of memory with ValueType elements.
Definition: flatten_fwd.hpp:16
auto string_replace(std::basic_string< C, T, A > &str, memory::basic_span< const C, P1, S1 > from, memory::basic_span< const C, P2, S2 > to) -> std::basic_string< C, T, A > &
Replaces all occurrences of from with to in the given string.
Definition: string_algo.hpp:26