通用函数

通用函数

名称 说明
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

说明:

串联两个或多个相同类型的值。

示例

values 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)
"hello" 5
[1, 2, 3, 4] 4
b"abcde" 5
null null
1 错误

REVERSE

语法

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

说明:

反转 StringBytesArray 值。

示例

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