str contains
for strings
Checks if string input contains a substring.
Signature
> str contains (string) ...rest --ignore-case --not
Parameters
string
: the substring to find...rest
: For a data structure input, check strings at the given cell paths, and replace with result--ignore-case
(-i)
: search is case insensitive--not
(-n)
: does not contain
Examples
Check if input contains string
> 'my_library.rb' | str contains '.rb'
true
Check if input contains string case insensitive
> 'my_library.rb' | str contains -i '.RB'
true
Check if input contains string in a table
> [[ColA ColB]; [test 100]] | str contains 'e' ColA
╭───┬──────┬──────╮
│ # │ ColA │ ColB │
├───┼──────┼──────┤
│ 0 │ true │ 100 │
╰───┴──────┴──────╯
Check if input contains string in a table
> [[ColA ColB]; [test 100]] | str contains -i 'E' ColA
╭───┬──────┬──────╮
│ # │ ColA │ ColB │
├───┼──────┼──────┤
│ 0 │ true │ 100 │
╰───┴──────┴──────╯
Check if input contains string in a table
> [[ColA ColB]; [test hello]] | str contains 'e' ColA ColB
╭───┬──────┬──────╮
│ # │ ColA │ ColB │
├───┼──────┼──────┤
│ 0 │ true │ true │
╰───┴──────┴──────╯
Check if input string contains 'banana'
> 'hello' | str contains 'banana'
false
Check if list contains string
> [one two three] | str contains o
╭───┬───────╮
│ 0 │ true │
│ 1 │ true │
│ 2 │ false │
╰───┴───────╯
Check if list does not contain string
> [one two three] | str contains -n o
╭───┬───────╮
│ 0 │ false │
│ 1 │ false │
│ 2 │ true │
╰───┴───────╯