Namespaces
Variants
Actions

std::isdigit(std::locale)

From cppreference.com
< cpp‎ | locale
 
 
 
 
Defined in header <locale>
template< class CharT >
bool isdigit( CharT ch, const locale& loc );

Checks if the given character is classified as a digit by the given locale's std::ctype facet.

Contents

[edit] Parameters

ch - character
loc - locale

[edit] Return value

Returns true if the character is classified as a digit, false otherwise.

[edit] Possible implementation

template<class CharT>
bool isdigit(CharT ch, const std::locale& loc)
{
    return std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::digit, ch);
}

[edit] Example

#include <iostream>
#include <locale>
#include <string>
#include <unordered_set>
 
struct jdigit_ctype : std::ctype<wchar_t>
{