mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
36 lines
896 B
Plaintext
36 lines
896 B
Plaintext
---
|
|
layout: docs
|
|
page_title: strlen - Functions - Configuration Language
|
|
description: The strlen function determines the length of a string.
|
|
---
|
|
|
|
# `strlen` Function
|
|
|
|
`strlen` determines the length of a given string.
|
|
|
|
```hcl
|
|
strlen(string)
|
|
```
|
|
|
|
## Examples
|
|
|
|
```shell-session
|
|
> length("hello")
|
|
5
|
|
```
|
|
|
|
When given a string, the result is the number of characters, rather than the
|
|
number of bytes or Unicode sequences that form them:
|
|
|
|
```shell-session
|
|
> length("👾🕹️")
|
|
2
|
|
```
|
|
|
|
A "character" is a _grapheme cluster_, as defined by
|
|
[Unicode Standard Annex #29](http://unicode.org/reports/tr29/). Note that
|
|
remote APIs may have a different definition of "character" for the purpose of
|
|
length limits on string arguments; a Nomad provider is responsible for
|
|
translating Nomad's string representation into that used by its respective
|
|
remote system and applying any additional validation rules to it.
|