Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
stringbool
list<string>list<bool>
tabletable
recordrecord

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'
╭───┬───────╮
│ 0 │ false │
│ 1 │ true  │
╰───┴───────╯

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

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