std::isupper(std::locale)(3)
πΈ NAME πΈ
std::isupper(std::locale) - std::isupper(std::locale) β okay bestie, this is literally the locale-aware version of isupper, straight from the C++ Standard Libary manual π
β¨
β¨ Synopsis β¨
Defined in header <locale> π
template< class CharT >
bool isupper( CharT ch, const locale& loc );
Checks if the given character is classified as an uppercase alphabetic character by the given locale's std::ctype facet. No cap, that's the whole vibe check π₯
π Parameters π
chβ characterlocβ locale
π¦ Return value π¦
Returns true if the character is classified as uppercase, false otherwise. Periodt π
π Possible implementation π
template<class CharT>
bool isupper(CharT ch, const std::locale& loc)
{
return std::use_facet<std::ctype<CharT>>(loc).is(std::ctype_base::upper, ch);
}
π Example π
Demonstrates the use of std::isupper() with different locales (OS-specific). Yes, bestie, OS-specific β keep that in mind π
// Run this code
#include <iostream>
#include <locale>
int main()
{
const wchar_t c = L'\u00de'; // LATIN CAPITAL LETTER THORN
std::locale loc1("C");
std::cout << std::boolalpha
<< "isupper('Γ', C locale) returned " << std::isupper(c, loc1) << '\n'
<< "islower('Γ', C locale) returned " << std::islower(c, loc1) << '\n';
std::locale loc2("en_US.UTF8");
std::cout << "isupper('Γ', Unicode locale) returned "
<< std::isupper(c, loc2) << '\n'
<< "islower('Γ', Unicode locale) returned "
<< std::islower(c, loc2) << '\n';
}
π Possible output π
isupper('Γ', C locale) returned false
islower('Γ', C locale) returned false
isupper('Γ', Unicode locale) returned true
islower('Γ', Unicode locale) returned false
π See also π
isupperβ checks if a character is an uppercase character (function)iswupperβ checks if a wide character is an uppercase character (function)
That's the whole page, bestie π«Ά source is http://cppreference.com, version/date is 2024.06.10, and this iconic little manual page is std::isupper(std::locale)(3) πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms