std::isalnum
De cppreference.com
<metanoindex/>
<tbody> </tbody>| Definido no cabeçalho <cctype>
|
||
int isalnum( int ch ); |
||
Verifica se o caráter dado é um caractere alfanumérico de acordo com a localidade C atual, ou seja, quer um número (
0123456789 no local padrão), uma letra maiúscula (ABCDEFGHIJKLMNOPQRSTUVWXYZ no local padrão), ou uma letra minúscula (abcdefghijklmnopqrstuvwxyz no local padrão).Original:
Checks if the given character is an alphanumeric character according to the current C locale, i.e. either a number (
0123456789 in the default locale), an uppercase letter (ABCDEFGHIJKLMNOPQRSTUVWXYZ in the default locale), or a lowercase letter (abcdefghijklmnopqrstuvwxyz in the default locale).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Parâmetros
| ch | - | personagem
Original: character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Valor de retorno
Valor diferente de zero (
true) se o personagem é um caractere alfanumérico, 0 (false) de outra forma.Original:
Non-zero value (
true) if the character is an alphanumeric character, 0 (false) otherwise.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exemplo
Demonstra o uso de isalnum () com diferentes localidades (OS-específica) .
Original:
Demonstrates the use of isalnum() with different locales (OS-specific).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
#include <iostream>
#include <cctype>
#include <clocale>
int main()
{
const char c = '\xdf'; // German letter ß in ISO-8859-1
std::cout << "isalnum(\'\\xdf\', default C locale) returned "
<< std::boolalpha << (bool)std::isalnum(c) << '\n';
std::setlocale(LC_ALL, "de_DE.iso88591");
std::cout << "isalnum(\'\\xdf\', ISO-8859-1 locale) returned "
<< std::boolalpha << (bool)std::isalnum(c) << '\n';
}
Saída:
isalnum('\xdf', default C locale) returned false
isalnum('\xdf', ISO-8859-1 locale) returned true
Veja também
checa se o caractere é classificado como alfanumérico pela localização Original: checks if a character is classified as alphanumeric by a locale The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (modelo de função) | |
verifica se um caractere largo é alfanumérico Original: checks if a wide character is alphanumeric The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (função) | |
Documentação C para isalnum
| |
