Spec-Zone.ru › Nushell

str substring for strings

Get part of a string. Note that the first character of a string is index 0.

Signature

> str substring {flags} (range) ...rest

Flags

  • --grapheme-clusters, -g: Count indexes and split using grapheme clusters (all visible chars have length 1).
  • --utf-8-bytes, -b: Count indexes and split using UTF-8 bytes (default; non-ASCII chars have length 2+).

Parameters

  • range: The indexes to substring [start end].
  • ...rest: For a data structure input, turn strings at the given cell paths into substrings.

Input/output types:

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

Examples

Get a substring "nushell" from the text "good nushell" using a range.

>  'good nushell' | str substring 5..11
nushell

Count indexes and split using grapheme clusters.

>  '🇯🇵ほげ ふが ぴよ' | str substring --grapheme-clusters 4..5
ふが

sub string by negative index.

>  'good nushell' | str substring 5..-2
nushel

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

Spec-Zone.ru

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