ฟังก์ชันทั่วไป

ฟังก์ชันทั่วไป

ชื่อ คำอธิบาย
CONCAT เชื่อมต่อค่า 2 ค่าขึ้นไปที่มีประเภทเดียวกัน
LENGTH คำนวณความยาวของ String, Bytes, Array, Vector หรือ Map
REVERSE ย้อนกลับ String, Bytes หรือ Array

ตัวอย่างไคลเอ็นต์

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

คำอธิบาย:

เชื่อมต่อค่า 2 ค่าขึ้นไปที่มีประเภทเดียวกัน

ตัวอย่าง

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[T <: STRING | BYTES | ARRAY | VECTOR | MAP](value: T) -> INT64

คำอธิบาย:

คำนวณความยาวของค่า String, Bytes, Array, Vector หรือ Map

ตัวอย่าง

value length(value)
"สวัสดี" 5
[1, 2, 3, 4] 4
b"abcde" 5
Null Null
1 ข้อผิดพลาด

ย้อนกลับ

ไวยากรณ์:

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

คำอธิบาย:

แสดงค่า String, Bytes หรือ Array แบบกลับกัน

ตัวอย่าง

value reverse(value)
"สวัสดี" "olleh"
[1, 2, 3] [3, 2, 1]
b"abc" b"cba"
23 ข้อผิดพลาด
Null Null