xtd 0.2.0
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1
4#pragma once
5#define __XTD_CORE_INTERNAL__
7#undef __XTD_CORE_INTERNAL__
8#include "basic_string.h"
9
12namespace xtd {
23
27 string to_ustring(int val);
31 string to_ustring(unsigned val);
35 string to_ustring(long val);
39 string to_ustring(unsigned long val);
43 string to_ustring(long long val);
47 string to_ustring(unsigned long long val);
51 string to_ustring(float val);
55 string to_ustring(double val);
59 string to_ustring(long double val);
63 template <typename type_t>
64 string to_ustring(type_t val) {
65 return string::format("{}", val);
66 }
67}
68
69/*
72#if defined(__xtd__cpp_lib_format)
73template <>
74struct std::formatter<xtd::string> : std::formatter<std::string> {
75 template <typename object_t, typename format_context_t>
76 auto format(const object_t& obj, format_context_t& ctx) const {return std::format_to(ctx.out(), "{}", std::string {obj.to_string()});}
77};
78#endif
80*/
81
83template<>
84inline std::string xtd::to_string(const xtd::string& value, const std::string& fmt, const std::locale& loc) {return value.to_string();}
85
Contains string definitions.
Contains xtd::basic_string class.
Represents text as a sequence of character units.
Definition basic_string.h:79
basic_string< char > to_string() const noexcept override
Converts the value of this instance to a xtd::basic_string <char>.
Definition basic_string.h:1919
static basic_string format(const basic_string< char > &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
xtd::basic_string< char > string
Represents text as a sequence of UTF-8 code units.
Definition __string_definitions.h:43
std::string to_string(const value_t &value, const std::string &fmt, const std::locale &loc)
Convert a specified value into a string with specified format and locale.
Definition to_string.h:41
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10