Kurlyk
Loading...
Searching...
No Matches
string_utils.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef KURLYK_HEADER_KURLYK_UTILS_STRING_UTILS_HPP_INCLUDED
3#define KURLYK_HEADER_KURLYK_UTILS_STRING_UTILS_HPP_INCLUDED
4
7
8#include <string>
9#include <algorithm>
10#include <cctype>
11
12namespace kurlyk {
13namespace utils {
14
18 inline std::string to_upper_case(std::string str) {
19 std::transform(str.begin(), str.end(), str.begin(), [](unsigned char ch) {
20 return static_cast<char>(std::toupper(ch));
21 });
22 return str;
23 }
24
28 inline std::string to_lower_case(std::string str) {
29 std::transform(str.begin(), str.end(), str.begin(), [](unsigned char ch) {
30 return static_cast<char>(std::tolower(ch));
31 });
32 return str;
33 }
34
35} // namespace utils
36} // namespace kurlyk
37
38#endif // KURLYK_HEADER_KURLYK_UTILS_STRING_UTILS_HPP_INCLUDED
std::string to_upper_case(std::string str)
Converts a string to uppercase.
std::string to_lower_case(std::string str)
Converts a string to lowercase.
Primary namespace for the Kurlyk library, encompassing initialization, request management,...