From fde6cbeb6868f38d1bb02454a5f6413c91935f5b Mon Sep 17 00:00:00 2001 From: Dave Henderson Date: Thu, 29 Dec 2022 09:45:38 -0500 Subject: Add strings.SkipLines function Signed-off-by: Dave Henderson --- docs-src/content/functions/strings.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'docs-src') diff --git a/docs-src/content/functions/strings.yml b/docs-src/content/functions/strings.yml index e4796bd3..709288b6 100644 --- a/docs-src/content/functions/strings.yml +++ b/docs-src/content/functions/strings.yml @@ -137,6 +137,29 @@ funcs: - | $ gomplate -i '{{ (coll.Slice "foo" "bar" "baz") | strings.Sort }}' [bar baz foo] + - name: strings.SkipLines + description: | + 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. + pipeline: true + arguments: + - name: skip + required: true + description: the number of lines to skip - must be a positive number + - name: in + required: true + description: the input string + examples: + - | + $ gomplate -i '{{ "foo\nbar\nbaz" | strings.SkipLines 2 }}' + baz + - | + $ gomplate -i '{{ strings.SkipLines 1 "foo\nbar\nbaz" }}' + bar + baz - name: strings.Split description: | _Not to be confused with [`split`](#split), which is deprecated._ -- cgit v1.2.3