std:: isxdigit (std::locale)
      From cppreference.net
     
     
     
        
         C++
        
        
         
          
           
          
          
         
        
       
       
        
         Text processing library
        
        
         
          
           
            
          
          
          
         
        
       
       | Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
              
  | 
            |||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
              
  | 
            |||||||||||||||||||||||||
        
         Localization library
        
        
         
          
           
            
          
          
          
         
        
       
       
              
  | 
            ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 
           
           Défini dans l'en-tête
            
         
            
             <locale>
            
           
           | 
         ||
| 
           
           
            
             template
            
            
             <
            
            
             class
            
            CharT
            
             >
            
             
         bool isxdigit ( CharT ch, const locale & loc ) ;  | 
         ||
Vérifie si le caractère donné est classifié comme un chiffre hexadécimal par la facette std::ctype de la locale spécifiée.
         Table des matières | 
       
Paramètres
| ch | - | caractère | 
| loc | - | paramètres régionaux | 
Valeur de retour
Retourne true si le caractère est classifié comme un chiffre hexadécimal, false sinon.
Implémentation possible
         template<class CharT> bool isxdigit(CharT ch, const std::locale& loc) { return std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::xdigit, ch); }  | 
       
` et contient des termes spécifiques au C++. Seule la partie descriptive en dehors du code aurait été traduite si elle existait, mais dans ce cas, le contenu est entièrement constitué de code C++.
Exemple
         Exécuter ce code
        
       #include <iostream> #include <locale> #include <string> #include <unordered_set> struct gxdigit_ctype : std::ctype<wchar_t> { std::unordered_set<wchar_t> greek_digits{L'α', L'β', L'γ', L'δ', L'ε', L'ζ'}; bool do_is(mask m, char_type c) const override { return (m & xdigit) && greek_digits.contains(c) ? true // 6 first Greek small letters will be classified as digits : ctype::do_is(m, c); // leave the rest to the parent class } }; int main() { std::wstring text = L"0123456789abcdefABCDEFαβγδεζηθικλμ"; std::locale loc(std::locale(""), new gxdigit_ctype); std::locale::global(std::locale("en_US.utf8")); std::wcout.imbue(std::locale()); std::wcout << "Hexadecimal digits in text: "; for (const wchar_t c : text) if (std::isxdigit(c, loc)) std::wcout << c << L' '; std::wcout << L'\n'; std::wcout << "Not hexadecimal digits in text: "; for (const wchar_t c : text) if (not std::isxdigit(c, loc)) std::wcout << c << L' '; std::wcout << L'\n'; }
Sortie :
Hexadecimal digits in text: 0 1 2 3 4 5 6 7 8 9 a b c d e f A B C D E F α β γ δ ε ζ Not hexadecimal digits in text: η θ ι κ λ μ
Voir aussi
| 
         vérifie si un caractère est un caractère hexadécimal
          (fonction)  | 
       |
| 
         vérifie si un caractère large est un caractère hexadécimal
          (fonction)  |