updated string interpolation docs
parent
6cef09039f
commit
7fbf960f12
|
@ -283,12 +283,6 @@ escaped_char = `\` ( "n" | "r" | "t" | `\` | `"` ) .
|
|||
StringExpression = "${" Expression "}" .
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
To be added: TODO: With string interpolation `string_lit` is not longer a lexical token as part of a literal, but an entire expression in and of itself.
|
||||
|
||||
[IMPL#252](https://github.com/influxdata/platform/issues/252) Parse string literals.
|
||||
{{% /note %}}
|
||||
|
||||
##### Examples of string literals
|
||||
|
||||
```js
|
||||
|
@ -300,12 +294,12 @@ To be added: TODO: With string interpolation `string_lit` is not longer a lexica
|
|||
```
|
||||
|
||||
String literals are also interpolated for embedded expressions to be evaluated as strings.
|
||||
Embedded expressions are enclosed in curly brackets (`{}`).
|
||||
Embedded expressions are enclosed within the literals `${` and `}` respectively.
|
||||
The expressions are evaluated in the scope containing the string literal.
|
||||
The result of an expression is formatted as a string and replaces the string content between the brackets.
|
||||
All types are formatted as strings according to their literal representation.
|
||||
A function `printf` exists to allow more precise control over formatting of various types.
|
||||
To include the literal curly brackets within a string they must be escaped.
|
||||
To include the literal `${` within a string, it must be escaped.
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#248](https://github.com/influxdata/platform/issues/248) Add printf function.
|
||||
|
@ -320,6 +314,10 @@ n = 42
|
|||
"dollar sign opening curly bracket \${" // dollar sign opening curly bracket ${
|
||||
```
|
||||
|
||||
{{% note %}}
|
||||
[IMPL#1775](https://github.com/influxdata/flux/issues/1775) Interpolate arbitrary expressions in string literals
|
||||
{{% /note %}}
|
||||
|
||||
### Regular expression literals
|
||||
|
||||
A _regular expression literal_ represents a regular expression pattern, enclosed in forward slashes.
|
||||
|
|
Loading…
Reference in New Issue