W3cubDocs

/Nushell

str ends-with for strings

Check if an input ends with a string.

Signature

> str ends-with {flags} (string) ...rest

Flags

  • --ignore-case, -i: search is case insensitive

Parameters

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

Input/output types:

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

Examples

Checks if string ends with '.rb'

>'my_library.rb'|str ends-with'.rb'
true

Checks if strings end with '.txt'

> ['my_library.rb', 'README.txt'] |str ends-with'.txt'
╭───┬───────╮
0false
1true
╰───┴───────╯

Checks if string ends with '.RB', case-insensitive

>'my_library.rb'|str ends-with-i'.RB'
true

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