From d97447c85fe6f1c917e68ae73fa91f7aa37a0c85 Mon Sep 17 00:00:00 2001 From: Joel Klinghed Date: Thu, 18 Nov 2021 00:16:50 +0100 Subject: strutil: Add to_lower_ascii --- src/strutil.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/strutil.cc') diff --git a/src/strutil.cc b/src/strutil.cc index adee769..a22f4b4 100644 --- a/src/strutil.cc +++ b/src/strutil.cc @@ -208,4 +208,14 @@ std::string rtrim(std::string const& str) { return str.substr(0, end); } +std::string to_lower_ascii(std::string_view str) { + std::string ret(str); + for (auto& c : ret) { + if (c >= 'A' && c <= 'Z') { + c |= 0x20; + } + } + return ret; +} + } // namespace str -- cgit v1.2.3-70-g09d2