Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

str snake-case for strings

Convert a string to snake_case.

Signature

> str snake-case {flags} ...rest

Parameters

  • ...rest: For a data structure input, convert strings at the given cell paths.

Input/output types:

inputoutput
stringstring
list<string>list<string>
tabletable
recordrecord

Examples

convert a string to snake_case

>  "NuShell" | str snake-case
nu_shell

convert a string to snake_case

>  "this_is_the_second_case" | str snake-case
this_is_the_second_case

convert a string to snake_case

> "this-is-the-first-case" | str snake-case
this_is_the_first_case

convert a column from a table to snake_case

> [[lang, gems]; [nuTest, 100]] | str snake-case lang
╭───┬─────────┬──────╮
│ # │  lang   │ gems │
├───┼─────────┼──────┤
│ 0 │ nu_test │  100 │
╰───┴─────────┴──────╯