一般函式

一般函式

名稱 說明
CONCAT 串連兩個以上相同類型的值。
LENGTH 計算 StringBytesArrayVectorMap 的長度。
REVERSE 反轉 StringBytesArray

客戶範例

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

語法:

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

說明:

串連兩個以上相同類型的值。

範例:

concat(values)
"abc", "def" "abcdef"
[1, 2]、[3, 4] [1, 2, 3, 4]
b"abc", b"def" b"abcdef"
"abc"、[1,2,3]、"ghi" 錯誤
[1,2,3] 錯誤
"abc", null null

LENGTH

語法:

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

說明:

計算 StringBytesArrayVectorMap 值的長度。

範例:

length(value)
「你好」 5
[1, 2, 3, 4] 4
b"abcde" 5
null null
1 錯誤

REVERSE

語法:

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

說明:

反轉 StringBytesArray 值。

範例:

reverse(value)
「你好」 「olleh」
[1, 2, 3] [3, 2, 1]
b"abc" b"cba"
23 錯誤
null null