Upper/Lower Case Converter
Introduction to English Letters
The English alphabet is a set of Latin letters used to write English and other languages. It consists of 26 letters divided into uppercase and lowercase forms. Uppercase letters are typically used for constants, abbreviations, or specific formatting requirements, while lowercase letters are more common in general text.
ASCII Introduction
ASCII (American Standard Code for Information Interchange) is a character encoding standard for electronic communication. It includes English letters (both cases), numbers, punctuation marks, and control characters, typically ranging from 0 to 127.
Uppercase Letters
In ASCII, uppercase Latin letters A-Z are encoded from 65 (A) to 90 (Z). Uppercase letters are commonly used for constants, abbreviations, and specific formatting requirements.
Lowercase Letters
Lowercase Latin letters a-z are encoded from 97 (a) to 122 (z). Lowercase letters are used for most regular text as they are more natural for reading.
Convert Uppercase to Lowercase
To convert uppercase to lowercase, add 32 to the ASCII code. For example, 'A' (65) becomes 'a' (97).
Convert Lowercase to Uppercase
To convert lowercase to uppercase, subtract 32 from the ASCII code. For example, 'a' (97) becomes 'A' (65).
Python Case Conversion Example
# Upper to lower:
text = "Hello World!"
upper_text = text.upper()
print(upper_text) # "HELLO WORLD!"
# lower to upper:
lower_text = text.lower()
print(lower_text) # "hello world!"
Java Case Conversion Example
public class CaseConverter {
public static void main(String[] args) {
String text = "Hello World!";
// To upper
String upperText = text.toUpperCase();
System.out.println(upperText); // "HELLO WORLD!"
// To lower
String lowerText = text.toLowerCase();
System.out.println(lowerText); // "hello world!"
}
}