Skip to main content

Description

Converts a string to snake_case format by separating words with underscores and converting all characters to lowercase.

Syntax

Parameters

Returns

Type: string The input string converted to snake_case format. Returns the original string if no matches are found. Returns null if input is null.

Examples

Example 1: Basic Usage

Output:

Example 2: Converting Multiple Formats

Output:

Example 3: Database Column Naming

Notes

  • Returns null for null input
  • Handles multiple word boundary detection patterns
  • All characters are converted to lowercase
  • Words are separated by underscores
  • Common for database column names and Python conventions
  • Returns the original string if no word boundaries are detected

See Also

Frequently Asked Questions

It recognizes spaces, hyphens, and camelCase/PascalCase word boundaries (transitions between lowercase and uppercase letters).
Yes. All characters in the output are converted to lowercase, with words separated by underscores.