5#if !defined(__XTD_CORE_INTERNAL__)
6#error "Do not include this file: Internal use only"
15template <
typename char_t>
16inline std::basic_string<char_t> __sprintf(
const char_t* fmt, ...) {
return std::basic_string<char_t>();}
19inline std::basic_string<char> __sprintf<char>(
const char* fmt, ...) {
22 std::basic_string<char> formatted_string(vsnprintf(
nullptr, 0, fmt, args), 0);
25 vsnprintf(&formatted_string[0], formatted_string.size() + 1, fmt, args);
27 if (formatted_string ==
"INF") formatted_string = {
'i',
'n',
'f'};
28 if (formatted_string ==
"-INF") formatted_string = {
'-',
'i',
'n',
'f'};
29 if (formatted_string ==
"NAN") formatted_string = {
'n',
'a',
'n'};
30 return formatted_string;
34inline std::basic_string<xtd::wchar> __sprintf<xtd::wchar>(
const xtd::wchar* fmt, ...) {
38 std::basic_string<xtd::wchar> formatted_string;
41 formatted_string = std::basic_string<xtd::wchar>(size, 0);
43 length = vswprintf(&formatted_string[0], formatted_string.size() + 1, fmt, args);
48 formatted_string.resize(length);
49 if (formatted_string == L
"INF") formatted_string = {
'i',
'n',
'f'};
50 if (formatted_string == L
"-INF") formatted_string = {
'-',
'i',
'n',
'f'};
51 if (formatted_string == L
"NAN") formatted_string = {
'n',
'a',
'n'};
52 return formatted_string;
wchar_t wchar
Represents a wide character.
Definition wchar.h:24
size_t size
Represents a size of any object in bytes.
Definition size.h:23
@ error
Allows critical and error events through.