Why naming style is a "language accent"
The same concept looks like this in four languages: userName (Java), user_name (Python), UserName (C# public property), user-name (CSS class). That's not arbitrary — each community writes in its habitual style, and readers rely on it to tell variables from constants from types at a glance. PascalCase at the start usually means a type; ALL_CAPS means a constant; camelCase means an ordinary variable. A codebase mixing styles reads as "unprofessional" in review before anything else.
Style migration is a real need: taking over a Python project that moves to Java, turning config keys into environment variables, converting JSON fields' snake_case to the frontend's camelCase. First the convention table, then the tricky rules — and batch processing with the Case Converter at the end.
| Style | Written | Conventional home |
|---|---|---|
| camelCase | userName |
Java/JS/TS variables and functions |
| PascalCase | UserName |
class names/types/Go exports |
| snake_case | user_name |
Python/Ruby variables, database columns |
| kebab-case | user-name |
CSS classes, URLs, file names |
| CONSTANT_CASE | USER_NAME |
constants, C macros, env vars |
| dot.case | user.name |
config keys, namespaces |
The three traps in conversion rules
Manual conversion looks like just adding underscores, but three boundaries decide quality:
1. Splitting consecutive capitals. HTTPServer should split into HTTP + Server (snake: http_server), not https erver or the flattened httpserver. Rule: the last capital of a run, when followed by a lowercase letter, starts the next word. Feed these inputs to any converter to judge it instantly.
2. Digit grouping. parseJSON2x keeping 2 attached (parse_json2x) reads better than parse_json_2_x; but should version2Beta become version2_beta or version_2_beta? Tools differ — this site's converter uses "digits stick to the preceding word" consistently throughout.
3. CJK mixed text. Converting 已获取 user_name 列表 to snake_case should preserve the Chinese (已获取_user_name_列表), not delete it as "non-identifier characters". That's a hard requirement for Chinese comments with embedded variable names in review and docs.
One more high-frequency scenario: ALL CAPS text to Title Case. ALL CAPS INPUT should become All Caps Input — lower the rest of each word first, then capitalize; a tool that only prepends capitals outputs ALL CAPS INPUT unchanged (as if nothing happened).
Built-in functions and shortcuts per language
For editing code (use tools for bulk text):
- Python:
"abc".upper()/.lower()/.title();.capitalize()for sentence-style first letter - JavaScript:
toUpperCase()/toLowerCase(); no built-in Title Case —replace(/\S+/g, w => w[0].toUpperCase() + w.slice(1).toLowerCase()) - C/C++:
toupper()/tolower()per character, withstd::transform - Command line:
tr 'a-z' 'A-Z'; seds/\b\w/\U&\gfor capitalizing - Shortcuts: JetBrains Ctrl+Shift+U toggles the selection; VS Code with a Change Case extension; Vim
U/u/~in visual mode
The batch workflow
What you usually convert is a list: variable names, a file-name manifest, JSON field lists. The Case Converter has a line-by-line batch mode for exactly this: each line converts independently, so user_name, getHTTPResponseCode, and 已获取 user_name 列表 in one paste all come out right; toggle batch off to merge the whole input into a single identifier (phrase → snake/kebab slug usage). Pair with Text Diff to verify lists, and JSON Formatter when migrating JSON field styles.
Frequently Asked Questions
Should I use camelCase or snake_case?
Follow the language's community convention: Java/JavaScript/TypeScript use camelCase for variables and functions, Python/Ruby use snake_case, Go uses PascalCase for exported identifiers and camelCase for private ones, CSS classes and URLs use kebab-case, and C macros/constants use CONSTANT_CASE. Team-internal consistency outranks language convention — batch-unify with an online case converter, then enforce with editor/linter naming rules.
What's the correct snake_case for consecutive capitals like HTTPServer?
http_server. The rule: when the last capital of a consecutive run is followed by a lowercase letter, it starts the next word — HTTPServer becomes HTTP + Server, and XMLHttpRequest becomes XML + Http + Request. Many naive converters output httpserver (losing the boundary semantics); test any tool with these two inputs to tell.
What are the built-in case conversion functions per language?
Python: str.upper()/lower()/title(); JavaScript: toUpperCase()/toLowerCase(); C++: toupper()/tolower() per character with std::transform; Java: toUpperCase()/toLowerCase(); command line: tr 'a-z' 'A-Z'. Use online tools for bulk text, built-ins when editing code.
What are the editor shortcuts for changing case?
VS Code: install a Change Case / Transform extension and bind keys (native offers Ctrl+Shift+U for uppercase on some layouts); JetBrains IDEs: Ctrl+Shift+U toggles the selection; Vim: ~ / U / u in visual mode; Emacs: M-u / M-l / M-c.