str kebab-case

For strings.

Convert a string to kebab-case.

Command Type

built-in

Signature

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

Parameters

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

Input/output types:

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

Examples

convert a string to kebab-case

> 'NuShell' | str kebab-case
nu-shell

convert a string to kebab-case

> 'thisIsTheFirstCase' | str kebab-case
this-is-the-first-case

convert a string to kebab-case

> 'THIS_IS_THE_SECOND_CASE' | str kebab-case
this-is-the-second-case

convert a column from a table to kebab-case

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

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.