Overview
The String Case Converter transforms text between common programming case styles. Intelligently parses existing casing and converts to the target format, handling transitions between all case styles.
Use Cases
API Design : Convert field names between conventions
Code Migration : Change variable naming conventions
Database Schema : Convert column names to snake_case
URL Slugs : Generate kebab-case slugs from titles
Constant Generation : Convert to SCREAMING_SNAKE_CASE
Title Formatting : Convert to Title Case for display
Any text in any case style:
Case Styles
camelCase (default)
First word lowercase, subsequent words capitalized:
helloWorld
userProfileSettings
httpResponseCode
PascalCase
All words capitalized, no separators:
HelloWorld
UserProfileSettings
HttpResponseCode
snake_case
All lowercase, words separated by underscores:
hello_world
user_profile_settings
http_response_code
kebab-case
All lowercase, words separated by hyphens:
hello-world
user-profile-settings
http-response-code
SCREAMING_SNAKE_CASE
All uppercase, words separated by underscores:
HELLO_WORLD
USER_PROFILE_SETTINGS
HTTP_RESPONSE_CODE
Title Case
First letter of each word capitalized, spaces between:
Hello World
User Profile Settings
Http Response Code
Converted string in target case style:
Examples
Input: camelCase to snake_case
Output (snake_case)
Input: snake_case to camelCase
Output (camelCase)
Input: kebab-case to PascalCase
Output (PascalCase)
Input: Title to SCREAMING_SNAKE_CASE
Output (SCREAMING_SNAKE_CASE)
Input: PascalCase to kebab-case
Output (kebab-case)
Input: Mixed to Title Case
Output (Title Case)
Input: Acronyms
Output (snake_case)
Conversion Matrix
From → To camelCase PascalCase snake_case kebab-case SCREAMING Title camelCase - ✓ ✓ ✓ ✓ ✓ PascalCase ✓ - ✓ ✓ ✓ ✓ snake_case ✓ ✓ - ✓ ✓ ✓ kebab-case ✓ ✓ ✓ - ✓ ✓ SCREAMING ✓ ✓ ✓ ✓ - ✓ Title ✓ ✓ ✓ ✓ ✓ -
Implementation Details
From lib/tools/engine.ts:804-821:
case 'string-case' : {
const words = input
.replace(/( [a - z])([ A - Z ])/g, '$1 $2') // Split camelCase
.replace(/[_\ - ]+/g, ' ') // Replace _ and - with space
.trim()
.split(/\s+/)
.filter(Boolean)
.map((w) => w.toLowerCase());
if (!words.length) return { output: '' };
switch ( action ) {
case 'pascal' : return { output: words . map (( w ) => w [ 0 ]. toUpperCase () + w . slice ( 1 )). join ( '' ) };
case 'snake' : return { output: words . join ( '_' ) };
case 'kebab' : return { output: words . join ( '-' ) };
case 'screaming' : return { output: words . join ( '_' ). toUpperCase () };
case 'title' : return { output: words . map (( w ) => w [ 0 ]. toUpperCase () + w . slice ( 1 )). join ( ' ' ) };
default : return { output: words [ 0 ] + words . slice ( 1 ). map (( w ) => w [ 0 ]. toUpperCase () + w . slice ( 1 )). join ( '' ) };
}
}
Word Splitting Algorithm :
Insert spaces before uppercase letters preceded by lowercase (camelCase split)
Replace underscores and hyphens with spaces
Trim and split on whitespace
Convert all words to lowercase
Apply target case transformation
Edge Cases
Acronyms
HTTPSConnection → https_connection
Consecutive capitals are treated as one word.
Numbers
version2API → version_2_api
Numbers are preserved as separate tokens.
Special Characters
Non-alphanumeric characters are removed (except _ and - in source).
Returns empty string.
Common Use Cases
JavaScript to Python
userFirstName → user_first_name
JSON to Database
URL Slug Generation
New Product Launch → new-product-launch
Constants
maxRetryCount → MAX_RETRY_COUNT
CSS Classes
primaryButton → primary-button
The String Case Converter uses a simple but effective algorithm that handles transitions between all common case styles without requiring knowledge of the source format.
For API field conversion, batch multiple fields by converting them one at a time, or use find-and-replace in your editor after converting a sample field name.
The converter cannot distinguish between acronyms and normal words. “API” becomes “api” in snake_case, not “a_p_i”. Manually adjust acronyms if needed.