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
69 template<typename char_t, typename traits_t, typename allocator_t>
70 inline xtd::string basic_string<char_t, traits_t, allocator_t>::to_string() const noexcept {return __xtd_convert_to_string<char>(chars_);}
71}
72
73/*
76#if defined(__xtd__cpp_lib_format)
77template <>
78struct std::formatter<xtd::string> : std::formatter<std::string> {
79 template <typename object_t, typename format_context_t>
80 auto format(const object_t& obj, format_context_t& ctx) const {return std::format_to(ctx.out(), "{}", std::string {obj.to_string()});}
81};
82#endif
84*/
85
87template<>
88inline std::string xtd::to_string(const xtd::string& value, const std::string& fmt, const std::locale& loc) {return value.to_string();}
89
Contains string definitions.
Contains xtd::basic_string class.
Represents text as a sequence of character units.
Definition basic_string.h:79
xtd::string to_string() const noexcept override
Converts the value of this instance to a xtd::basic_string <char>.
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