Spec-Zone.ru › Nushell

str distance for strings

Compare two strings and return the edit distance/Levenshtein distance.

Signature

> str distance {flags} (compare-string) ...rest

Parameters

  • compare-string: The first string to compare.
  • ...rest: For a data structure input, check strings at the given cell paths, and replace with result.

Input/output types:

input output
string int
table table
record record

Examples

Get the edit distance between two strings.

> 'nushell' | str distance 'nutshell'
1

Compute edit distance between strings in table and another string, using cell paths.

> [{a: 'nutshell' b: 'numetal'}] | str distance 'nushell' 'a' 'b'
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 1 │ 4 │
╰───┴───┴───╯

Compute edit distance between strings in record and another string, using cell paths.

> {a: 'nutshell' b: 'numetal'} | str distance 'nushell' a b
╭───┬───╮
│ a │ 1 │
│ b │ 4 │
╰───┴───╯

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/str_distance.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API