Partager via


isalpha

Teste si un élément défini des paramètres régionaux est une lettre.

template<Class CharType> 
   bool isalpha( 
      CharType _Ch,  
      const locale& _Loc 
   )

Paramètres

  • _Ch
    L'élément à tester.

  • _Loc
    Les paramètres régionaux qui contient l'élément alphabétique à tester.

Valeur de retour

true si l'élément est testé alphabétique ; false dans le cas contraire.

Notes

La fonction de modèle retourne use_facet<C<CharType> >(_Loc).est(::<dectype>CharTypealpha, _Ch).

Exemple

// locale_isalpha.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>

using namespace std;

int main( )   
{
   locale loc ( "German_Germany" );
   bool result1 = isalpha ( 'L', loc);
   bool result2 = isalpha ( '@', loc);
   bool result3 = isalpha ( '3', loc);

   if ( result1 )
      cout << "The character 'L' in the locale is "
           << "alphabetic." << endl;
   else
      cout << "The character 'L' in the locale is "
           << " not alphabetic." << endl;

   if ( result2 )
      cout << "The character '@' in the locale is "
           << "alphabetic." << endl;
   else
      cout << "The character '@' in the locale is "
           << " not alphabetic." << endl;

   if ( result3 )
      cout << "The character '3' in the locale is "
           << "alphabetic." << endl;
   else
      cout << "The character '3' in the locale is "
           << " not alphabetic." << endl;
}

Sortie

The character 'L' in the locale is alphabetic.
The character '@' in the locale is  not alphabetic.
The character '3' in the locale is  not alphabetic.

Configuration requise

**En-tête :**paramètres régionaux <de >

Espace de noms : std