0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-18 09:40:12 +01:00

ircd: Add missing replace() stringops overload.

This commit is contained in:
Jason Volk 2018-03-25 14:57:09 -07:00
parent f36af09789
commit bdd5006f32

View file

@ -99,6 +99,7 @@ namespace ircd
std::string replace(std::string, const char &before, const char &after);
std::string replace(std::string, const string_view &before, const string_view &after);
std::string replace(const string_view &, const char &before, const string_view &after);
std::string replace(const string_view &, const string_view &before, const string_view &after);
// Truncate view at maximum length
string_view trunc(const string_view &, const size_t &max);
@ -111,6 +112,14 @@ ircd::trunc(const string_view &s,
return { s.data(), std::min(s.size(), max) };
}
inline std::string
ircd::replace(const string_view &s,
const string_view &before,
const string_view &after)
{
return replace(std::string{s}, before, after);
}
inline std::string
ircd::replace(std::string s,
const string_view &before,