github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/website/content/docs/job-specification/hcl2/functions/string/substr.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: substr - Functions - Configuration Language
     4  sidebar_title: substr
     5  description: |-
     6    The substr function extracts a substring from a given string by offset and
     7    length.
     8  ---
     9  
    10  # `substr` Function
    11  
    12  `substr` extracts a substring from a given string by offset and length.
    13  
    14  ```hcl
    15  substr(string, offset, length)
    16  ```
    17  
    18  ## Examples
    19  
    20  ```shell-session
    21  > substr("hello world", 1, 4)
    22  ello
    23  ```
    24  
    25  The offset and length are both counted in _unicode characters_ rather than
    26  bytes:
    27  
    28  ```shell-session
    29  > substr("🤔🤷", 0, 1)
    30  🤔
    31  ```