Funzioni generiche

Funzioni generiche

Nome Descrizione
CONCAT Concatena due o più valori dello stesso tipo.
LENGTH Calcola la lunghezza di un String, Bytes, Array, Vector o Map.
REVERSE Inverte un String, Bytes o Array.

Esempi di clienti

Node.js
concat(constant("Author ID: "), field("authorId"));

Web

concat(constant("Author ID: "), field("authorId"));
Swift
let displayString = Constant("Author ID: ").concat([Field("authorId")])

Kotlin

val displayString = constant("Author ID: ").concat(field("authorId"))

Java

Expression displayString = constant("Author ID: ").concat(field("authorId"));
Python
Constant.of("Author ID: ").concat(Field.of("authorId"))

CONCAT

Sintassi:

concat[T <: STRING | BYTES | ARRAY](values:T ...) -> T

Descrizione:

Concatena due o più valori dello stesso tipo.

Esempi:

valori concat(values)
"abc", "def" "abcdef"
[1, 2], [3, 4] [1, 2, 3, 4]
b"abc", b"def" b"abcdef"
"abc", [1,2,3], "ghi" errore
[1,2,3] errore
"abc", null null

LENGTH

Sintassi:

length[T <: STRING | BYTES | ARRAY | VECTOR | MAP](value: T) -> INT64

Descrizione:

Calcola la lunghezza di un valore String, Bytes, Array, Vector o Map.

Esempi:

valore length(value)
"hello" 5
[1, 2, 3, 4] 4
b"abcde" 5
null null
1 errore

REVERSE

Sintassi:

reverse[T <: STRING | BYTES | ARRAY](value: T) -> T

Descrizione:

Inverte un valore String, Bytes o Array.

Esempi:

valore reverse(value)
"hello" "olleh"
[1, 2, 3] [3, 2, 1]
b"abc" b"cba"
23 errore
null null