yq/pkg/yqlib/doc/String Operators.md
2021-02-11 10:58:40 +11:00

542 B

String Operators

Join strings

Given a sample.yml file of:

- cat
- meow
- 1
- null
- true

then

yq eval 'join("; ")' sample.yml

will output

cat; meow; 1; ; true

Split strings

Given a sample.yml file of:

cat; meow; 1; ; true

then

yq eval 'split("; ")' sample.yml

will output

- cat
- meow
- "1"
- ""
- "true"

Split strings one match

Given a sample.yml file of:

word

then

yq eval 'split("; ")' sample.yml

will output

- word