Lowercase

5 snippets across 5 stacks — Bash & Linux, HTML & CSS, JavaScript, Python, SQL

SHBash & Linux

Translate or Delete Characters

SH · Text Processing
syntax
tr [options] set1 [set2]
example
echo 'Hello World' | tr 'A-Z' 'a-z'
cat data.csv | tr ',' '\t'
tr -d '\r' < windows_file.txt > unix_file.txt
output
hello world

Note tr reads only from stdin (it cannot take a filename argument). -d deletes characters in set1. -s squeezes repeated characters. Converting \r is handy for fixing Windows line endings.

HCHTML & CSS

Text Transform

HC · Typography
syntax
text-transform: uppercase | lowercase | capitalize | none;
example
.label {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.name {
  text-transform: capitalize;
}

Note When using uppercase, add letter-spacing (0.04em to 0.1em) to improve readability. Keep actual content in normal case in the HTML since text-transform is purely visual and screen readers may spell out uppercase letters.

JSJavaScript

Case Conversion

JS · Strings
syntax
str.toUpperCase()
str.toLowerCase()
str.toLocaleUpperCase(locale)
example
const status = "Pending";
console.log(status.toUpperCase());  // "PENDING"
console.log(status.toLowerCase());  // "pending"

// Locale-aware (e.g., Turkish "i" -> "I" with dot)
console.log("istanbul".toLocaleUpperCase("tr"));

Note Always use locale-aware methods when dealing with internationalized text. The Turkish i is a classic bug source.

PYPython

Common String Methods

PY · Strings
syntax
str.method()
example
email = "  [email protected]  "
print(email.strip().lower())
print("hello world".title())
print("python".startswith("py"))
print("2026-04-04".replace("-", "/"))
output
[email protected]
Hello World
True
2026/04/04

Note String methods always return new strings since strings are immutable. Chain methods for compact transformations.

SQLSQL

UPPER / LOWER

SQL · String Functions
syntax
UPPER(string)
LOWER(string)
example
SELECT
  UPPER(last_name) AS last_upper,
  LOWER(email) AS email_lower
FROM users;
output
-- last_upper | email_lower
-- JOHNSON    | [email protected]

Note Useful for case-insensitive comparisons: WHERE LOWER(email) = LOWER('[email protected]'). For better performance on frequent case-insensitive lookups, create a functional index on LOWER(column). PostgreSQL also offers ILIKE.