How To Use Text Case Conventions
📖 Bu rehber ToolPazar ekibi tarafından hazırlanmıştır. Tüm araçlarımız ücretsiz ve reklamsızdır.
The six cases you’ll use
camelCase, PascalCase, snake_case, kebab-case, SCREAMING_CASE, Title Case — and they’re not interchangeable. Mixing them in a single codebase looks amateur; picking the wrong one for a URL or an environment variable breaks things silently. This guide covers each case convention, where it’s standard, the reasoning behind each choice, the edge cases (acronyms, numbers, leading underscores), and the style-guide rules that top-tier codebases follow.
Matching case to context
camelCase for variables, functions, methods. PascalCase for classes, types, components, interfaces. SCREAMING_SNAKE_CASE for constants. kebab-case for file names (usually), though PascalCase for React component files is also common.
Acronyms — the hardest edge case
camelCase for unexported. PascalCase for exported (public). Visibility encoded in case — the language enforces it, so convention isn’t optional.
Numbers in identifiers
snake_case for variables and methods. PascalCase for classes and modules. SCREAMING_SNAKE_CASE for constants (Ruby enforces — start with a capital letter = constant).
Title Case rules
snake_case for variables and functions. PascalCase for types, traits, and enums. SCREAMING_SNAKE_CASE for constants and statics.
Converting between cases programmatically
How do you write “HTTP server” in camelCase?
Style guides worth reading
For headlines and display text, Title Case isn’t just “capitalize every word.” Conventions exist:
Common mistakes
When you need to convert programmatically, most languages have libraries or quick regex approaches: