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 | |||||||||||||||||||||||||
|
|
Defined in header <locale> | ||
template<class CharT> bool isspace( CharT ch,const locale& loc); | ||
Checks if the given character is classified as a whitespace character by the given locale'sstd::ctype facet.
Contents |
ch | - | character |
loc | - | locale |
Returnstrue if the character is classified as a whitespace character,false otherwise.
template<class CharT>bool isspace(CharT ch,conststd::locale& loc){returnstd::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::space, ch);} |
Demonstrates the use ofstd::isspace()
with different locales (OS-specific).
#include <iostream>#include <locale> void try_with(wchar_t c,constchar* loc){std::wcout<<"isspace('"<< c<<"', locale(\""<< loc<<"\")) returned "<<std::boolalpha<<std::isspace(c,std::locale(loc))<<'\n';} int main(){constwchar_t EM_SPACE= L'\u2003';// Unicode character 'EM SPACE' try_with(EM_SPACE,"C"); try_with(EM_SPACE,"en_US.UTF8");}
Possible output:
isspace(' ', locale("C")) returned falseisspace(' ', locale("en_US.UTF8")) returned true
checks if a character is a space character (function)[edit] | |
checks if a wide character is a space character (function)[edit] |