github.com/jbramsden/hugo@v0.47.1/docs/content/en/functions/trim.md (about)

     1  ---
     2  title: trim
     3  # linktitle:
     4  description: Returns a slice of a passed string with all leading and trailing characters from cutset removed.
     5  godocref:
     6  date: 2017-02-01
     7  publishdate: 2017-02-01
     8  lastmod: 2017-02-01
     9  categories: [functions]
    10  menu:
    11    docs:
    12      parent: "functions"
    13  keywords: [strings]
    14  signature: ["trim INPUT CUTSET"]
    15  workson: []
    16  hugoversion:
    17  relatedfuncs: []
    18  deprecated: false
    19  ---
    20  
    21  ```
    22  {{ trim "++Batman--" "+-" }} → "Batman"
    23  ```
    24  
    25  `trim` *requires* the second argument, which tells the function specifically what to remove from the first argument. There is no default value for the second argument, so **the following usage will not work**:
    26  
    27  ```
    28  {{ trim .Inner}}
    29  ```
    30  
    31  Instead, the following example tells `trim` to remove extra new lines from the content contained in the [shortcode `.Inner` variable][shortcodevars]:
    32  
    33  ```
    34  {{ trim .Inner "\n" }}
    35  ```
    36  
    37  {{% note %}}
    38  Go templates also provide a simple [method for trimming whitespace](/templates/introduction/#whitespace) from either side of a Go tag by including a hyphen (`-`).
    39  {{% /note %}}
    40  
    41  
    42  [shortcodevars]: /variables/shortcodes/