mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-24 15:28:54 +00:00
e48ffb7635
ef9c4913cClean up and removal of outdated examples46122c9aaadd godot tutorials to showcase06d1d1ea2Update scss-sass.md1fc63c100Spelling fix in 0.79.1 release notesad2f50e3dUpdate plainwords description (#1296)33021d451Update substr examples (#1304)6b1cc59bbRelease 0.80.0521db8c6dMerge branch 'tempv0.80.0'58626c2b3releaser: Add release notes to /docs for release of 0.80.0f81d118afdartsass: Dart Sass only supports `expanded` and `compressed`7da6f54beAdd Dart Sass supportb1f2661bbReplace jsconfig.js with jsconfig.json38de0c1a4Update index.md223ceae80Update index.mdf7ac0e59dRelease v0.79.12d4583d43Merge branch 'temp791-2'1d34e609breleaser: Add release notes to /docs for release of 0.79.1e26769988Merge branch 'temp791'75694d904Fix Resource.ResourceType so it always returns MIME's main type0f65d7783Typo s/adds/add (#1298)0b896b2c0images: Add images.Overlay filter0d4257dcdClarify documentation on shimmingfcf601ddfUpdate index.html6bf9bc1c1Update index.html1ce76bf3aUpdate index.htmle7d976eecUpdate index.htmldb2996e64Update index.html245e5bfc9news: Add post about Apple M13ad4115edtpl: Add title parameter to YouTube shortcode76ed976f8Added two useful extensions to the list (#1243)e5a30dd11Update related.md25cf8f48bImprove substr examplese16e57e9aUpdate path.Split.md2749b88fdUpdate path.Split.mdd76cad3ffRelease 0.79.0f5ccfbe98releaser: Add release notes to /docs for release of 0.79.0ebf1b87b0Merge commit '9f1265fde4b9ef186148337c99f08601633b6056'1f1e8f39cAllow setting the delimiter used for setting config via OS env, e.g. HUGO_e9b1414dddeps: Update to github.com/evanw/esbuild 0.8.11 to 0.8.140f76cf66cdocs: Regen docshelper1ada5d47eAdd menu params1c120aef0Revert "docs: Regenerate docshelper"7b60b5624docs: Regenerate docshelper git-subtree-dir: docs git-subtree-split:ef9c4913cd
1.3 KiB
1.3 KiB
title, description, godocref, date, publishdate, lastmod, categories, menu, keywords, aliases, signature, workson, hugoversion, relatedfuncs, deprecated
| title | description | godocref | date | publishdate | lastmod | categories | menu | keywords | aliases | signature | workson | hugoversion | relatedfuncs | deprecated | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| substr | Extracts parts of a string from a specified character's position and returns the specified number of characters. | 2017-02-01 | 2017-02-01 | 2017-02-01 |
|
|
|
|
false |
It normally takes two parameters: start and length. It can also take one parameter: start, i.e. length is omitted, in which case the substring starting from start until the end of the string will be returned.
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 "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"