check lowercase letters c++ code example

Example 1: how to compare lower case character to uppercase cpp

for(int i=0;i<str.size();i++){
int c = str[i]; 
        if (islower(c))  
            str[i] = toupper(c);
}

Example 2: convert characters to lowercase c++

str[i] = tolower(str[i]);

Example 3: uppercase capitalise character in string c++

str[i] = toupper(str[i]);

Example 4: check if character in string is uppercase c++

if (isupper(str[i])) {
	// str[i] is uppercase
}

Example 5: check lowercase letters c++

char character = 'a'; //0110 0001
if(character & 0x20) {
	//is lowercase
}

Tags:

Cpp Example