2019-10-31 18:40:56 +01:00
|
|
|
# str
|
|
|
|
|
|
|
|
Consumes either a single value or a table and converts the provided data to a string and optionally applies a change.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
```shell
|
|
|
|
> shells
|
|
|
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ │ name │ path
|
|
|
|
───┼───┼────────────┼────────────────────────────────
|
|
|
|
0 │ X │ filesystem │ /home/TUX/stuff/expr/stuff
|
|
|
|
1 │ │ filesystem │ /
|
|
|
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
> shells | str path --upcase
|
|
|
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ │ name │ path
|
|
|
|
───┼───┼────────────┼────────────────────────────────
|
|
|
|
0 │ X │ filesystem │ /HOME/TUX/STUFF/EXPR/STUFF
|
|
|
|
1 │ │ filesystem │ /
|
|
|
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
> shells | str path --downcase
|
|
|
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ │ name │ path
|
|
|
|
───┼───┼────────────┼────────────────────────────────
|
|
|
|
0 │ X │ filesystem │ /home/tux/stuff/expr/stuff
|
|
|
|
1 │ │ filesystem │ /
|
|
|
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
> shells | str # --substring "21, 99"
|
|
|
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ │ name │ path
|
|
|
|
───┼───┼────────────┼────────────────────────────────
|
|
|
|
0 │ X │ filesystem │ stuff
|
|
|
|
1 │ │ filesystem │
|
|
|
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
> shells | str # --substring "6,"
|
|
|
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ │ name │ path
|
|
|
|
───┼───┼────────────┼────────────────────────────────
|
|
|
|
0 │ X │ filesystem │ TUX/stuff/expr/stuff
|
|
|
|
1 │ │ filesystem │
|
|
|
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
2019-11-01 23:25:08 +01:00
|
|
|
|
|
|
|
> echo "1, 2, 3" | split-row "," | str --to-int | sum
|
|
|
|
━━━━━━━━━
|
|
|
|
<value>
|
|
|
|
─────────
|
|
|
|
6
|
|
|
|
━━━━━━━━━
|
2020-04-24 23:37:58 +02:00
|
|
|
|
|
|
|
> echo "nu" | str --capitalize
|
|
|
|
━━━━━━━━━
|
|
|
|
<value>
|
|
|
|
─────────
|
|
|
|
Nu
|
|
|
|
━━━━━━━━━
|
|
|
|
|
|
|
|
> echo "Nu " | str --trim
|
|
|
|
━━━━━━━━━
|
|
|
|
<value>
|
|
|
|
─────────
|
|
|
|
Nu
|
|
|
|
━━━━━━━━━
|
2020-04-25 08:07:38 +02:00
|
|
|
> shells | str path --find-replace ["TUX" "skipper"]
|
|
|
|
━━━┯━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
# │ │ name │ path
|
|
|
|
───┼───┼────────────┼────────────────────────────────
|
|
|
|
0 │ X │ filesystem │ /home/skipper/stuff/expr/stuff
|
|
|
|
1 │ │ filesystem │ /
|
|
|
|
━━━┷━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
|
|
|
|
|
|
```
|