diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2022-12-29 09:45:38 -0500 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2022-12-29 09:45:38 -0500 |
| commit | fde6cbeb6868f38d1bb02454a5f6413c91935f5b (patch) | |
| tree | 49891d1400fbbb05804c662bd1e4a480f4a59ce0 /docs/content/functions/strings.md | |
| parent | db2957873903b397188d96dd4119f1ed9c2a0ea9 (diff) | |
Add strings.SkipLines function
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs/content/functions/strings.md')
| -rw-r--r-- | docs/content/functions/strings.md | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/content/functions/strings.md b/docs/content/functions/strings.md index 57d3965f..37859d5a 100644 --- a/docs/content/functions/strings.md +++ b/docs/content/functions/strings.md @@ -207,6 +207,42 @@ $ gomplate -i '{{ (coll.Slice "foo" "bar" "baz") | strings.Sort }}' [bar baz foo] ``` +## `strings.SkipLines` + +Skips the given number of lines (each ending in a `\n`), returning the +remainder. + +If `skip` is greater than the number of lines in `in`, an empty string is +returned. + +### Usage + +```go +strings.SkipLines skip in +``` +```go +in | strings.SkipLines skip +``` + +### Arguments + +| name | description | +|------|-------------| +| `skip` | _(required)_ the number of lines to skip - must be a positive number | +| `in` | _(required)_ the input string | + +### Examples + +```console +$ gomplate -i '{{ "foo\nbar\nbaz" | strings.SkipLines 2 }}' +baz +``` +```console +$ gomplate -i '{{ strings.SkipLines 1 "foo\nbar\nbaz" }}' +bar +baz +``` + ## `strings.Split` _Not to be confused with [`split`](#split), which is deprecated._ |
