github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/job-specification/hcl2/functions/string/substr.mdx (about)

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