Documents v0.9.0 · previews run the real runtime · experimental features are marked exp

split()

expressionsince 0.5experimentalrequires runtime

Splits a string into a list, only as the single argument of pick(). Entries are trimmed and empty entries dropped.

On this page · 8 sections+

Syntax

pick(split(<text>, "<delimiter>"))

registry syntax: split(text, "delimiter")

Parameters

text<string> or attr()required
The text to split.
delimiternon-empty <string>required
There is no escape for the delimiter itself: choose one that does not occur in the values.

Return value

A transient list for pick(). The list is never stored, so state stays one scalar value.

Example

shuffle.cssreactive
.shuffle {  --message: state("Hello");}.shuffle:on(click) {  --message: set(pick(split(attr(data-greetings), "|")));}
state()Function · hover any red tokenMakes each matching element the owner of an independent state with an initial value.Reference →

Behavior

  • Entries are trimmed; empty entries are dropped.

Supported contexts

  • Only as the single argument of pick() inside state() or set().

Limitations

  • Experimental since 0.5.0.
  • No slice() or other list functions.
Experimental · syntax may change between minor versions