summaryrefslogtreecommitdiffstats
path: root/docs/content/en/functions
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-01-20 12:48:39 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2021-01-20 12:48:39 +0100
commita1a9f088b1b087b0991f8890865c95b359eea51c (patch)
tree5cb5ed0fb1445b24f42ce116d363fac72a74c89a /docs/content/en/functions
parent07ad283f686904e5835f621d73ed342ba2a48eb3 (diff)
parente48ffb763572814a3788780bb9653dfa2daeae22 (diff)
Diffstat (limited to 'docs/content/en/functions')
-rw-r--r--docs/content/en/functions/path.Split.md6
-rw-r--r--docs/content/en/functions/substr.md19
2 files changed, 20 insertions, 5 deletions
diff --git a/docs/content/en/functions/path.Split.md b/docs/content/en/functions/path.Split.md
index d6bc15ce9..2d6aff6bb 100644
--- a/docs/content/en/functions/path.Split.md
+++ b/docs/content/en/functions/path.Split.md
@@ -25,7 +25,7 @@ If there is no slash in `PATH`, it returns an empty directory and the base is se
**Note:** On Windows, `PATH` is converted to slash (`/`) separators.
```
-{{ path.Split "a/news.html" }} → "a/", "news.html"
-{{ path.Split "news.html" }} → "", "news.html"
-{{ path.Split "a/b/c" }} → "a/b/", "c"
+{{ $dirFile := path.Split "a/news.html" }} → $dirDile.Dir → "a/", $dirFile.File → "news.html"
+{{ $dirFile := path.Split "news.html" }} → $dirDile.Dir → "", $dirDile.File → "news.html"
+{{ $dirFile := path.Split "a/b/c" }} → $dirDile.Dir → "a/b/", $dirDile.File → "c"
```
diff --git a/docs/content/en/functions/substr.md b/docs/content/en/functions/substr.md
index feb25aa1b..c02141ab2 100644
--- a/docs/content/en/functions/substr.md
+++ b/docs/content/en/functions/substr.md
@@ -26,6 +26,21 @@ To extract characters from the end of the string, use a negative start number.
In addition, borrowing from the extended behavior described at https://php.net substr, if `length` is given and is negative, that number of characters will be omitted from the end of string.
```
-{{substr "BatMan" 0 -3}} → "Bat"
-{{substr "BatMan" 3 3}} → "Man"
+{{ substr "abcdef" 0 }} → "abcdef"
+{{ substr "abcdef" 1 }} → "bcdef"
+
+{{ substr "abcdef" 0 1 }} → "a"
+{{ substr "abcdef" 1 1 }} → "b"
+
+{{ substr "abcdef" 0 -1 }} → "abcde"
+{{ substr "abcdef" 1 -1 }} → "bcde"
+
+{{ substr "abcdef" -1 }} → "f"
+{{ substr "abcdef" -2 }} → "ef"
+
+{{ substr "abcdef" -1 1 }} → "f"
+{{ substr "abcdef" -2 1 }} → "e"
+
+{{ substr "abcdef" -3 -1 }} → "de"
+{{ substr "abcdef" -3 -2 }} → "d"
```