diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2022-12-29 15:00:49 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-29 15:00:49 +0000 |
| commit | f8a636898f316ce0d4a9a12335e9633c218f9e8a (patch) | |
| tree | 49891d1400fbbb05804c662bd1e4a480f4a59ce0 /docs | |
| parent | db2957873903b397188d96dd4119f1ed9c2a0ea9 (diff) | |
| parent | fde6cbeb6868f38d1bb02454a5f6413c91935f5b (diff) | |
Merge pull request #1587 from hairyhenderson/strings-skip-lines
Add strings.SkipLines function
Diffstat (limited to 'docs')
| -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._ |
