userver: userver/utils/text.hpp Source File
⚠️ This is the documentation for an old userver version. Click here to switch to the latest version.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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,
19 bool is_fixed = true);
20
21/// Transform letters to lower case
22std::string ToLower(std::string_view str,
23 const std::string& locale = kEnLocale);
24
25/// Transform letters to upper case
26std::string ToUpper(std::string_view str,
27 const std::string& locale = kEnLocale);
28
29/// Capitalizes the first letter of the str
30std::string Capitalize(std::string_view str, const std::string& locale);
31
32/// Returns a locale with the specified name
33const std::locale& GetLocale(const std::string& name);
34
35} // namespace utils::text
36
37USERVER_NAMESPACE_END