std::wcstoul, std::wcstoull
cppreference.com
<tbody>
</tbody>
unsigned long wcstoul( const wchar_t* str, wchar_t** str_end, int base ); |
||
unsigned long long wcstoull( const wchar_t* str, wchar_t** str_end, int base ); |
( C++11) | |
, str.
( std::iswspace) , , -n ( n=base) . :
- ()
- () (
0), (,80) - () (
0x0X), (,160) - .
{0,2,3,...,36}. 2 {0,1}, 3 {0,1,2}, . , 10, , Aa 11, Zz 36. .
base 0, : 0, , 0x 0X, , .
, str_end, . str_end , .
| str | , | |
| str_end | ||
| base |
, str . , ULONG_MAX ULLONG_MAX. , 0.
#include <cwchar>
#include <errno.h>
#include <iostream>
#include <string>
int main()
{
std::setlocale(LC_ALL, "en_US.utf8");
const wchar_t* p = L"10 200000000000000000000000000000 30 40";
wchar_t *end;
std::wcout << L" L'" << p << "':\n";
for (unsigned long i = std::wcstoul(p, &end, 10);
p != end;
i = std::wcstoul(p, &end, 10))
{
std::wcout << '\'' << std::wstring(p, end-p) << "' -> ";
p = end;
if (errno == ERANGE)
{
std::wcout << L" , ";
errno = 0;
}
std::wcout << i << '\n';
}
}
:
L'10 200000000000000000000000000000 30 40':
'10' -> 10
' 200000000000000000000000000000' -> , 18446744073709551615
' 30' -> 30
' 40' -> 40
(C++11) |
() |
| () | |
C wcstoul, wcstoull
| |