std::isspace(std::locale)
De cppreference.com
<tbody>
</tbody>
| Definido en el archivo de encabezado <locale>
|
||
template< class charT > bool isspace( charT ch, const locale& loc ); |
||
Comprueba si el carácter dado se clasifica como un carácter de espacio en blanco por la faceta ctype de la configuración regional dada.
Parámetros
| ch | - | Carácter |
| loc | - | Configuración regional |
Valor de retorno
Devuelve true si el carácter se clasifica como un carácter de espacio en blanco, de otra forma, false.
Posible implementación
template< class charT >
bool isspace( charT ch, const std::locale& loc ) {
return std::use_facet<std::ctype<charT>>(loc).is(std::ctype_base::space, ch);
}
|
Ejemplo
Demuestra el uso de isspace() con diferentes configuraciones regionales (específico del sistema operativo).
Ejecuta este código
#include <iostream>
#include <locale>
void try_with(wchar_t c, const char* loc)
{
std::wcout << "isspace('" << c << "', locale(\"" << loc << "\")) ha devuelto "
<< std::boolalpha << std::isspace(c, std::locale(loc)) << '\n';
}
int main()
{
const wchar_t EM_SPACE = L'\u2003'; // carácter Unicode 'EM SPACE'
try_with(EM_SPACE, "C");
try_with(EM_SPACE, "en_US.UTF8");
}
Salida:
isspace(' ', locale("C")) ha devuelto false
isspace(' ', locale("en_US.UTF8")) ha devuelto true
Véase también
Comprueba si un carácter es un carácter de espacio Original: checks if a character is a space character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función) | |
Comprueba si un carácter ancho es un carácter de espacio Original: checks if a wide character is a space character The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función) |