1
0
mirror of https://github.com/taigrr/yq synced 2025-01-18 04:53:17 -08:00

Added split string operator

This commit is contained in:
Mike Farah
2021-01-14 15:05:50 +11:00
parent d21c94cf4f
commit 62acee54c3
6 changed files with 111 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
# String Operators
## Join strings
Given a sample.yml file of:
@@ -17,3 +18,35 @@ will output
cat; meow; 1; ; true
```
## Split strings
Given a sample.yml file of:
```yaml
cat; meow; 1; ; true
```
then
```bash
yq eval 'split("; ")' sample.yml
```
will output
```yaml
- cat
- meow
- "1"
- ""
- "true"
```
## Split strings one match
Given a sample.yml file of:
```yaml
word
```
then
```bash
yq eval 'split("; ")' sample.yml
```
will output
```yaml
- word
```

View File

@@ -0,0 +1 @@
# String Operators