Skip to content

New built-in function for string interpolation #392

@saig0

Description

@saig0

Is your feature request related to a problem? Please describe.
FEEL supports string concatenation using the + operator. For short strings, this is easy and sufficient. But it gets messy for bigger strings or string templating.

Other languages (e.g. Scala, Kotlin, etc.) support string interpolation for this case. Common syntax:

// Scala
s"Hello $name"

// Kotlin
"Hello $name"

Or, for more complex expressions:

// Scala
s"Hello ${name.forename}"

// Kotlin
"Hello ${name.forename}"

Describe the solution you'd like
Provide a new built-in function for strings to support a simple form of string interpolation.

  • function name: string template()
  • arguments:
    • template: string - the template as a string with $<variable name> as placeholders
  • result:
    • string - evaluated template that contains the variable value instead of the placeholders
    • null - if a variable is not present or the template is invalid

Example:

string template("Hello $name")
// "Hello world"

string template("The score of $name is $score.")
// "The score of Jon is 78."

Related issues

  • Camunda BPM:
  • Zeebe broker:

Related conversation

Related to camunda/camunda-modeler#5202

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions