snake_case

string

Converts a string to snake_case format

Syntax

snake_case(string)

Parameters

string (string)

The string to convert

Returns

string

String converted to snake_case

Examples

Input:
snake_case("HelloWorld")
Output:
"hello_world"
Input:
snake_case("Hello World")
Output:
"hello_world"
Input:
"CamelCase" | snake_case
Output:
"camel_case"

The snake_case() function converts a string to snake_case format, where words are lowercase and separated by underscores.

Usage

Use snake_case() for converting identifiers to Python or database naming conventions, or when standardizing variable names.

Related Functions