W3cubDocs

/Nushell

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:

input output
list<string> list<string>
record record
string string
table table

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-caselang
╭───┬─────────┬──────╮
# │  lang   │ gems │
├───┼─────────┼──────┤
0nu_test100
╰───┴─────────┴──────╯

Tips: Command str snake-case was not included in the official binaries by default, you have to build it with --features=extra flag

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/str_snake-case.html