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

     1  ---
     2  layout: docs
     3  page_title: strlen - Functions - Configuration Language
     4  description: The strlen function determines the length of a string.
     5  ---
     6  
     7  # `strlen` Function
     8  
     9  `strlen` determines the length of a given string.
    10  
    11  ```hcl
    12  strlen(string)
    13  ```
    14  
    15  ## Examples
    16  
    17  ```shell-session
    18  > length("hello")
    19  5
    20  ```
    21  
    22  When given a string, the result is the number of characters, rather than the
    23  number of bytes or Unicode sequences that form them:
    24  
    25  ```shell-session
    26  > length("👾🕹️")
    27  2
    28  ```
    29  
    30  A "character" is a _grapheme cluster_, as defined by
    31  [Unicode Standard Annex #29](http://unicode.org/reports/tr29/). Note that
    32  remote APIs may have a different definition of "character" for the purpose of
    33  length limits on string arguments; a Nomad provider is responsible for
    34  translating Nomad's string representation into that used by its respective
    35  remote system and applying any additional validation rules to it.