From 8fdd4be2acf66be69c67478fcf54733e2b2943c4 Mon Sep 17 00:00:00 2001 From: anulax1225 Date: Wed, 6 Mar 2024 22:56:53 +0100 Subject: [PATCH] Added a to_lower_case function --- sandbox/server/http/http_tools.cpp | 9 +++++++++ sandbox/server/http/http_tools.h | 1 + 2 files changed, 10 insertions(+) diff --git a/sandbox/server/http/http_tools.cpp b/sandbox/server/http/http_tools.cpp index d192bf4..1eca456 100644 --- a/sandbox/server/http/http_tools.cpp +++ b/sandbox/server/http/http_tools.cpp @@ -1,5 +1,14 @@ #include "http_tools.h" +std::string string_to_lower(std::string& str) +{ + for (int i = 0; i < str.length(); i++) + { + str[i] = std::tolower(str[i]); + } + return str; +} + std::string string_to_upper(std::string& str) { for (int i = 0; i < str.length(); i++) diff --git a/sandbox/server/http/http_tools.h b/sandbox/server/http/http_tools.h index c555b7d..0a039ed 100644 --- a/sandbox/server/http/http_tools.h +++ b/sandbox/server/http/http_tools.h @@ -2,6 +2,7 @@ #include +std::string string_to_lower(std::string& str); std::string string_to_upper(std::string& str); std::unique_ptr> string_split(std::string s, std::string delimiter, int cpt = -1); std::string string_trim(const std::string& str, const std::string& whitespace = " "); \ No newline at end of file