Snake Case Converter

Converts the input string to snake case.

Input: TextResult: Text

Text input

Tool options

Examples

Map an API property to a database-column style

Input

createdAt

Expected answer

created_at
Attempt to be context aware
Off
Separate an acronym from the next word

HTTP is treated as one word.

Input

HTTPResponseCode

Expected answer

http_response_code
Attempt to be context aware
Off
Normalize a measurement heading containing a number

The digit 2 forms its own word boundary; inspect the exact output before adopting a schema name.

Input

CO2 concentration ppm

Expected answer

co_2_concentration_ppm
Attempt to be context aware
Off
Deburr a city name for a plain ASCII identifier

The original diacritics are removed.

Input

São Paulo station

Expected answer

sao_paulo_station
Attempt to be context aware
Off
Rename bare tokens while retaining a quoted key

Context mode protects double-quoted text; review real code with its parser before applying replacements.

Input

firstName = "displayName"; maxRetries = 5;

Expected answer

first_name = "displayName"; max_retries = 5;
Attempt to be context aware
On
To Snake case (dumb)

Input

hello world

Expected answer

hello_world
Attempt to be context aware
Off
To Snake case (smart)

Input

test='hello'
echo $test
aSnakeCaseFunction
$aSnakeCaseVariable;
function functionName() {
  console.log('things inside quotes do not get broken');
  console.log("things inside quotes do not get broken");
}

Expected answer

test='hello'
echo $test
a_snake_case_function
$a_snake_case_variable;
function function_name() {
  console.log('things inside quotes do not get broken');
  console.log("things inside quotes do not get broken");
}
Attempt to be context aware
On

Snake case is all lower case with underscores as word boundaries. e.g. this_is_snake_case 'Attempt to be context aware' will make the operation attempt to nicely transform variable and function names.

Format reference: To Snake case background and specification

Parameters

ParameterDefault valueInput and choices
Attempt to be context awarefalseOn or off

Related tools

Browse code tidy tools