Talk:cpp/string/byte/isdigit
From cppreference.com
[edit] "some implementations (e.g. Microsoft in 1252 codepage) may classify additional single-byte characters as digits"
Where is the evidence that this is the case? Which characters?
I would expect this only from the locale version of isdigit.
There is a comment referring to a note in the C standard which states that it is not affected by the locale.
Simon (talk) 03:01, 31 March 2021 (PDT)
- Run this code in visual studio:
Run this code
#include <cctype> #include <clocale> #include <iostream> int main() { std::setlocale(LC_ALL, ".1252"); for (unsigned c{}; c < 0x100; ++c) if (std::isdigit(c)) std::cout << c << ": " << char(c) << '\n'; }
Output:
48: 0 49: 1 50: 2 51: 3 52: 4 53: 5 54: 6 55: 7 56: 8 57: 9 178: ² 179: ³ 185: ¹
[edit] Using plain char is work in GCC and clang
I apologize for my lack of knowledge on the matter.