Uppercase Converter
UPPERCASE writes HELLO WORLD EXAMPLE. It transforms every character, leaving spacing and punctuation intact ā useful for headings, reference codes and shouting at your terminal.
Conversions
| Input | UPPERCASE |
|---|---|
hello world example | HELLO WORLD EXAMPLE |
XMLHttpRequest | XMLHTTPREQUEST |
user_first_name | USER_FIRST_NAME |
Total Order Count | TOTAL ORDER COUNT |
XMLHttpRequest becomes XMLHTTPREQUEST and all structure is lost. As with lowercasing, the transformation cannot be reversed.The Same Text in Other Cases
| Case | Result |
|---|---|
| camelCase | helloWorldExample |
| PascalCase | HelloWorldExample |
| snake_case | hello_world_example |
| SCREAMING_SNAKE_CASE | HELLO_WORLD_EXAMPLE |
| kebab-case | hello-world-example |
| Train-Case | Hello-World-Example |
Where UPPERCASE Fits
Uppercasing is used for emphasis in prose and for normalising values that are conventionally capitalised ā country codes, currency codes, reference numbers. Long runs of uppercase are markedly harder to read, so it belongs on short strings.
Converting in Code
``javascript
const upper = (s) => s.toUpperCase();
`
Uppercasing can change string length. The German Ć upper-cases to SS, so a value that fitted a fixed-width column may no longer fit, and a round trip through upper and lower does not return the original.
Uppercasing Is Not as Simple as It Looks
toUpperCase() is locale-dependent, and the exceptions bite in production:
| Input | Naive uppercase | Correct |
|---|---|---|
i (Turkish locale) | I | İ |
Ć (German) | Ć | SS |
ļ¬ (ligature) | ļ¬ | FI |
The Turkish dotless-i problem is the classic: 'i'.toUpperCase() gives I in most locales
and İ in Turkish, which breaks case-insensitive comparison of identifiers, file paths and
HTTP headers.For comparison, never uppercase ā use toLocaleLowerCase() or, better,
localeCompare with sensitivity: 'base'.
For display, prefer CSS: text-transform: uppercase keeps the underlying text intact for
copy-paste, search and screen readers, which read shouted text differently. All-caps is also
measurably slower to read for more than a few words, since word shape disappears.
Converting at the API Boundary
The recurring friction is that JavaScript uses camelCase and Python, Ruby, Go and SQL use
snake_case. The fix is to convert in exactly one place ā the client that talks to the API ā
rather than letting both conventions into the same codebase.
`javascript
const toCamel = (s) => s.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
const toSnake = (s) => s.replace(/[A-Z]/g, (c) => '_' + c.toLowerCase());
// Recursively, for a whole payload
const convertKeys = (value, fn) =>
Array.isArray(value)
? value.map((v) => convertKeys(v, fn))
: value && typeof value === 'object'
? Object.fromEntries(Object.entries(value).map(([k, v]) => [fn(k), convertKeys(v, fn)]))
: value;
`
Two things to watch: keys that are user data rather than field names must not be
converted, and the round trip is not always lossless ā userID ā user_id ā userId
changes the original.
Where Each Convention Is Mandatory
Not stylistic ā these will break if you deviate:
| Context | Requirement |
|---|---|
| Environment variables | Uppercase with underscores; POSIX reserves lowercase |
| Custom HTML elements | Must contain a hyphen |
| Python modules | Cannot contain hyphens; the import statement will not parse |
| SQL identifiers | Folded to one case unless quoted, so camelCase does not survive |
| React components | Must start uppercase, or JSX treats it as an HTML tag |
Renaming Safely
A find-and-replace across a codebase will hit strings, comments and unrelated identifiers.
Use your language server's rename symbol instead ā it understands scope. For a bulk rename
across files, restrict the pattern with word boundaries and review the diff before
committing:
`bash
grep -rn '\buserId\b' src/ # look first
``