In this recipe, you will learn how to convert all of the lowercase vowels in a sentence to uppercase. The remaining characters in the sentence, including consonants, numbers, special symbols, and special characters, are simply ignored and will be left as they are.
Converting the casing of any letter is done by simply changing the ASCII value of that character, using the following formulas:
- Subtract 32 from the ASCII value of a lowercase character to convert it to uppercase
- Add 32 to the ASCII value of an uppercase character to convert it to lowercase
The following diagram shows the ASCII values of the uppercase and lowercase vowels:
Figure 2.12
The ASCII value of the uppercase letters is lower than that of lowercase letters, and the difference between the values is 32.