userver: userver/utils/text.hpp Source File
Loading...
Searching...
No Matches
text.hpp
Go to the documentation of this file.
1#pragma once
2
3/// @file userver/utils/text.hpp
4/// @brief Text utilities
5
6#include <locale>
7
8#include <userver/utils/text_light.hpp>
9
10USERVER_NAMESPACE_BEGIN
11
12/// @brief Text utilities
13namespace utils::text {
14
15inline const std::string kEnLocale{"en_US.UTF-8"};
16
17/// Return number formatted with specified locale
18std::string Format(double value, const std::string& locale, int ndigits = 0, bool is_fixed = true);
19
20/// Transform letters to lower case
21std::string ToLower(std::string_view str, const std::string& locale = kEnLocale);
22
23/// Transform letters to upper case
24std::string ToUpper(std::string_view str, const std::string& locale = kEnLocale);
25
26/// Capitalizes the first letter of the str
27std::string Capitalize(std::string_view str, const std::string& locale);
28
29/// Returns a locale with the specified name
30const std::locale& GetLocale(const std::string& name);
31
32} // namespace utils::text
33
34USERVER_NAMESPACE_END