Kurlyk
Loading...
Searching...
No Matches
string_utils.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _KURLYK_UTILS_STRING_UTILS_HPP_INCLUDED
3#define _KURLYK_UTILS_STRING_UTILS_HPP_INCLUDED
4
7
8#include <string>
9#include <algorithm>
10
11namespace kurlyk::utils {
12
16 inline std::string to_upper_case(std::string str) {
17 std::transform(str.begin(), str.end(), str.begin(), [](unsigned char ch) {
18 return static_cast<char>(std::toupper(ch));
19 });
20 return str;
21 }
22
26 inline std::string to_lower_case(std::string str) {
27 std::transform(str.begin(), str.end(), str.begin(), [](unsigned char ch) {
28 return static_cast<char>(std::tolower(ch));
29 });
30 return str;
31 }
32
33} // namespace kurlyk::utils
34
35#endif // _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.