ฟังก์ชันสตริง

ฟังก์ชันสตริง

ชื่อ คำอธิบาย
BYTE_LENGTH แสดงผลจำนวน BYTES ในค่า STRING หรือ BYTES
CHAR_LENGTH แสดงผลจำนวนอักขระ Unicode ใน STRING value
STARTS_WITH แสดง TRUE หาก STRING ขึ้นต้นด้วยคำนำหน้าที่ระบุ
ENDS_WITH แสดง TRUE หาก STRING ลงท้ายด้วยคำต่อท้ายที่ระบุ
LIKE แสดงผล TRUE หาก STRING ตรงกับรูปแบบ
REGEX_CONTAINS แสดงผล TRUE หากค่าตรงกับนิพจน์ทั่วไปทั้งหมดหรือบางส่วน
REGEX_MATCH แสดงผล TRUE หากค่าส่วนใดส่วนหนึ่งตรงกับนิพจน์ทั่วไป
STRING_CONCAT ต่อ STRING หลายรายการเป็น STRING
STRING_CONTAINS แสดงผล TRUE หากค่ามี STRING
TO_UPPER แปลงค่า STRING หรือ BYTES เป็นตัวพิมพ์ใหญ่
TO_LOWER แปลงค่า STRING หรือ BYTES เป็นตัวพิมพ์เล็ก
SUBSTRING รับสตริงย่อยของค่า STRING หรือ BYTES
STRING_REVERSE กลับค่า STRING หรือ BYTES
TRIM ตัดอักขระนำหน้าและต่อท้ายออกจากค่า STRING หรือ BYTES
SPLIT แยกค่า STRING หรือ BYTES ออกเป็นอาร์เรย์

BYTE_LENGTH

ไวยากรณ์:

byte_length[T <: STRING | BYTES](value: T) -> INT64

คำอธิบาย:

แสดงผลจำนวน BYTES ในค่า STRING หรือ BYTES

ตัวอย่าง

value byte_length(value)
"abc" 3
"xyzabc" 6
b"abc" 3

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").byteLength().as("titleByteLength")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("title").byteLength().as("titleByteLength")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("title").byteLength().alias("titleByteLength")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("title").byteLength().alias("titleByteLength")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("title").byte_length().as_("titleByteLength"))
    .execute()
)

CHAR_LENGTH

ไวยากรณ์:

char_length(value: STRING) -> INT64

คำอธิบาย:

แสดงผลจำนวนจุดรหัส Unicode ในค่า STRING

ตัวอย่าง

value char_length(value)
"abc" 3
"สวัสดี" 5
"โลก" 5

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").charLength().as("titleCharLength")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("title").charLength().as("titleCharLength")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("title").charLength().alias("titleCharLength")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("title").charLength().alias("titleCharLength")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("title").char_length().as_("titleCharLength"))
    .execute()
)

STARTS_WITH

ไวยากรณ์:

starts_with(value: STRING, prefix: STRING) -> BOOLEAN

คำอธิบาย:

แสดงผล TRUE หาก value ขึ้นต้นด้วย prefix

ตัวอย่าง

value คำนำหน้า starts_with(value, prefix)
"abc" "ก" จริง
"abc" "b" เท็จ
"abc" "" จริง

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").startsWith("The")
      .as("needsSpecialAlphabeticalSort")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("title").startsWith("The")
      .as("needsSpecialAlphabeticalSort")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("title").startsWith("The")
            .alias("needsSpecialAlphabeticalSort")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("title").startsWith("The")
            .alias("needsSpecialAlphabeticalSort")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(
        Field.of("title").starts_with("The").as_("needsSpecialAlphabeticalSort")
    )
    .execute()
)

ENDS_WITH

ไวยากรณ์:

ends_with(value: STRING, postfix: STRING) -> BOOLEAN

คำอธิบาย:

แสดง TRUE หาก value ลงท้ายด้วย postfix

ตัวอย่าง

value Postfix ends_with(value, postfix)
"abc" "c" จริง
"abc" "b" เท็จ
"abc" "" จริง
Swift
let result = try await db.pipeline()
  .collection("inventory/devices/laptops")
  .select([
    Field("name").endsWith("16 inch")
      .as("16InLaptops")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("inventory/devices/laptops")
    .select(
        field("name").endsWith("16 inch")
            .alias("16InLaptops")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("inventory/devices/laptops")
    .select(
        field("name").endsWith("16 inch")
            .alias("16InLaptops")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("inventory/devices/laptops")
    .select(Field.of("name").ends_with("16 inch").as_("16InLaptops"))
    .execute()
)

ชอบ

ไวยากรณ์:

like(value: STRING, pattern: STRING) -> BOOLEAN

คำอธิบาย:

แสดงผล TRUE หาก value ตรงกับ pattern

ตัวอย่าง

value pattern like(value, pattern)
"Firestore" "Fire%" จริง
"Firestore" "%store" จริง
"Datastore" "Data_tore" จริง
"100%" "100\%" จริง

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("genre").like("%Fiction")
      .as("anyFiction")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("genre").like("%Fiction")
      .as("anyFiction")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("genre").like("%Fiction")
            .alias("anyFiction")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("genre").like("%Fiction")
            .alias("anyFiction")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("genre").like("%Fiction").as_("anyFiction"))
    .execute()
)

REGEX_CONTAINS

ไวยากรณ์:

regex_contains(value: STRING, pattern: STRING) -> BOOLEAN

คำอธิบาย:

แสดงผล TRUE หากส่วนใดส่วนหนึ่งของ value ตรงกับ pattern หาก pattern ไม่ใช่นิพจน์ทั่วไปที่ถูกต้อง ฟังก์ชันนี้จะแสดงผล error

นิพจน์ทั่วไปเป็นไปตามไวยากรณ์ของไลบรารี re2

ตัวอย่าง

value pattern regex_contains(value, pattern)
"Firestore" "ไฟ" จริง
"Firestore" "store$" จริง
"Firestore" "ข้อมูล" เท็จ

Web

const result = await execute(db.pipeline()
  .collection("documents")
  .select(
    field("title").regexContains("Firestore (Enterprise|Standard)")
      .as("isFirestoreRelated")
  )
);
Swift
let result = try await db.pipeline()
  .collection("documents")
  .select([
    Field("title").regexContains("Firestore (Enterprise|Standard)")
      .as("isFirestoreRelated")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("documents")
    .select(
        field("title").regexContains("Firestore (Enterprise|Standard)")
            .alias("isFirestoreRelated")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("documents")
    .select(
        field("title").regexContains("Firestore (Enterprise|Standard)")
            .alias("isFirestoreRelated")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("documents")
    .select(
        Field.of("title")
        .regex_contains("Firestore (Enterprise|Standard)")
        .as_("isFirestoreRelated")
    )
    .execute()
)

REGEX_MATCH

ไวยากรณ์:

regex_match(value: STRING, pattern: STRING) -> BOOLEAN

คำอธิบาย:

แสดงผล TRUE หาก value ตรงกับ pattern ทั้งหมด หาก pattern ไม่ใช่นิพจน์ทั่วไปที่ถูกต้อง ฟังก์ชันนี้จะแสดงผล error

นิพจน์ทั่วไปเป็นไปตามไวยากรณ์ของไลบรารี re2

ตัวอย่าง

value pattern regex_match(value, pattern)
"Firestore" "F.*store" จริง
"Firestore" "ไฟ" เท็จ
"Firestore" "^F.*e$" จริง

Web

const result = await execute(db.pipeline()
  .collection("documents")
  .select(
    field("title").regexMatch("Firestore (Enterprise|Standard)")
      .as("isFirestoreExactly")
  )
);
Swift
let result = try await db.pipeline()
  .collection("documents")
  .select([
    Field("title").regexMatch("Firestore (Enterprise|Standard)")
      .as("isFirestoreExactly")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("documents")
    .select(
        field("title").regexMatch("Firestore (Enterprise|Standard)")
            .alias("isFirestoreExactly")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("documents")
    .select(
        field("title").regexMatch("Firestore (Enterprise|Standard)")
            .alias("isFirestoreExactly")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("documents")
    .select(
        Field.of("title")
        .regex_match("Firestore (Enterprise|Standard)")
        .as_("isFirestoreExactly")
    )
    .execute()
)

STRING_CONCAT

ไวยากรณ์:

string_concat(values: STRING...) -> STRING

คำอธิบาย:

เชื่อมต่อSTRINGค่าตั้งแต่ 2 ค่าขึ้นไปเป็นผลลัพธ์เดียว

ตัวอย่าง

อาร์กิวเมนต์ string_concat(values...)
() ข้อผิดพลาด
("a") "ก"
("abc", "def") "abcdef"
("a", "", "c") "ac"

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").stringConcat(" by ", field("author"))
      .as("fullyQualifiedTitle")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("title").concat([" by ", Field("author")])
      .as("fullyQualifiedTitle")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("title").concat(" by ", field("author"))
            .alias("fullyQualifiedTitle")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("title").concat(" by ", field("author"))
            .alias("fullyQualifiedTitle")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(
        Field.of("title")
        .concat(" by ", Field.of("author"))
        .as_("fullyQualifiedTitle")
    )
    .execute()
)

STRING_CONTAINS

ไวยากรณ์:

string_contains(value: STRING, substring: STRING) -> BOOLEAN

คำอธิบาย:

ตรวจสอบว่า value มีสตริงตามตัวอักษร substring หรือไม่

ตัวอย่าง

value สตริงย่อย string_contains(value, substring)
"abc" "b" จริง
"abc" "d" เท็จ
"abc" "" จริง
"a.c" "." จริง
"☃☃☃" "☃" จริง

Web

const result = await execute(db.pipeline()
  .collection("articles")
  .select(
    field("body").stringContains("Firestore")
      .as("isFirestoreRelated")
  )
);
Swift
let result = try await db.pipeline()
  .collection("articles")
  .select([
    Field("body").stringContains("Firestore")
      .as("isFirestoreRelated")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("articles")
    .select(
        field("body").stringContains("Firestore")
            .alias("isFirestoreRelated")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("articles")
    .select(
        field("body").stringContains("Firestore")
            .alias("isFirestoreRelated")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("articles")
    .select(Field.of("body").string_contains("Firestore").as_("isFirestoreRelated"))
    .execute()
)

TO_UPPER

ไวยากรณ์:

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

คำอธิบาย:

แปลงค่า STRING หรือ BYTES เป็นตัวพิมพ์ใหญ่

หากไบต์หรืออักขระไม่สอดคล้องกับอักขระที่เป็นตัวอักษรพิมพ์เล็ก UTF-8 ระบบจะส่งผ่านโดยไม่มีการเปลี่ยนแปลง

ตัวอย่าง

value to_upper(value)
"abc" "ABC"
"AbC" "ABC"
b"abc" b"ABC"
b"a1c" b"A1C"

Web

const result = await execute(db.pipeline()
  .collection("authors")
  .select(
    field("name").toUpper()
      .as("uppercaseName")
  )
);
Swift
let result = try await db.pipeline()
  .collection("authors")
  .select([
    Field("name").toUpper()
      .as("uppercaseName")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("authors")
    .select(
        field("name").toUpper()
            .alias("uppercaseName")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("authors")
    .select(
        field("name").toUpper()
            .alias("uppercaseName")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("authors")
    .select(Field.of("name").to_upper().as_("uppercaseName"))
    .execute()
)

TO_LOWER

ไวยากรณ์:

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

คำอธิบาย:

แปลงค่า STRING หรือ BYTES เป็นตัวพิมพ์เล็ก

หากไบต์หรืออักขระไม่สอดคล้องกับอักขระตัวอักษรตัวพิมพ์ใหญ่ UTF-8 ระบบจะส่งผ่านโดยไม่มีการเปลี่ยนแปลง

ตัวอย่าง

value to_lower(value)
"ABC" "abc"
"AbC" "abc"
"A1C" "a1c"
b"ABC" b"abc"

Web

const result = await execute(db.pipeline()
  .collection("authors")
  .select(
    field("genre").toLower().equal("fantasy")
      .as("isFantasy")
  )
);
Swift
let result = try await db.pipeline()
  .collection("authors")
  .select([
    Field("genre").toLower().equal("fantasy")
      .as("isFantasy")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("authors")
    .select(
        field("genre").toLower().equal("fantasy")
            .alias("isFantasy")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("authors")
    .select(
        field("genre").toLower().equal("fantasy")
            .alias("isFantasy")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("authors")
    .select(Field.of("genre").to_lower().equal("fantasy").as_("isFantasy"))
    .execute()
)

SUBSTRING

ไวยากรณ์:

substring[T <: STRING | BYTES](input: T, position: INT64) -> T
substring[T <: STRING | BYTES](input: T, position: INT64, length: INT64) -> T

คำอธิบาย:

แสดงผลสตริงย่อยของ input โดยเริ่มที่ position (ดัชนีที่อิงตาม 0) และ รวมรายการสูงสุด length รายการ หากไม่ได้ระบุ length ระบบจะแสดงสตริงย่อย จาก position ไปจนถึงสิ้นสุด input

  • หาก input เป็นค่า STRING ระบบจะวัด position และ length ในโค้ดพอยต์ Unicode หากเป็นค่า BYTES ระบบจะวัดค่าเป็นไบต์

  • หาก position มากกว่าความยาวของ input ระบบจะแสดงผลสตริงย่อยที่ว่างเปล่า หาก position บวก length มากกว่าความยาวของ input ระบบจะตัดสตริงย่อยให้เหลือแค่ส่วนท้ายของ input

  • หาก position เป็นค่าลบ ระบบจะใช้ตำแหน่งจากท้ายอินพุต หากค่าลบของ position มากกว่าขนาดของอินพุต ระบบจะตั้งค่าตำแหน่งเป็น 0 length ต้องไม่เป็นค่าลบ

ตัวอย่าง

เมื่อไม่ได้ระบุ length

อินพุต position substring(input, position)
"abc" 0 "abc"
"abc" 1 "bc"
"abc" 3 ""
"abc" -1 "c"
b"abc" 1 b"bc"

เมื่อระบุlength

อินพุต position ความยาว substring(input, position, length)
"abc" 0 1 "ก"
"abc" 1 2 "bc"
"abc" -1 1 "c"
b"abc" 0 1 b"a"

Web

const result = await execute(db.pipeline()
  .collection("books")
  .where(field("title").startsWith("The "))
  .select(
    field("title").substring(4)
      .as("titleWithoutLeadingThe")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .where(Field("title").startsWith("The "))
  .select([
    Field("title").substring(position: 4)
      .as("titleWithoutLeadingThe")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .where(field("title").startsWith("The "))
    .select(
        field("title")
          .substring(constant(4),
            field("title").charLength().subtract(4))
            .alias("titleWithoutLeadingThe")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .where(field("title").startsWith("The "))
    .select(
        field("title").substring(
          constant(4),
            field("title").charLength().subtract(4))
            .alias("titleWithoutLeadingThe")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .where(Field.of("title").starts_with("The "))
    .select(Field.of("title").substring(4).as_("titleWithoutLeadingThe"))
    .execute()
)

STRING_REVERSE

ไวยากรณ์:

string_reverse[T <: STRING | BYTES](input: T) -> T

คำอธิบาย:

แสดงผลอินพุตที่ระบุในลำดับย้อนกลับ

ระบบจะกำหนดขอบเขตอักขระด้วยโค้ดพอยต์ Unicode เมื่ออินพุตเป็น STRING และไบต์เมื่ออินพุตเป็นค่า BYTES

ตัวอย่าง

อินพุต string_reverse(input)
"abc" "cba"
"a🌹b" "b🌹a"
"สวัสดี" "olleh"
b"abc" b"cba"

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("name").reverse().as("reversedName")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("name").reverse().as("reversedName")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("name").reverse().alias("reversedName")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("name").reverse().alias("reversedName")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("name").string_reverse().as_("reversedName"))
    .execute()
)

TRIM

ไวยากรณ์:

trim[T <: STRING | BYTES](input: T, values_to_trim: T) -> T
trim[T <: STRING | BYTES](input: T) -> T

คำอธิบาย:

ตัดชุด BYTES หรือ CHARS ที่ระบุออกจากจุดเริ่มต้นและจุดสิ้นสุดของ input ที่ระบุ

  • หากไม่ได้ระบุ values_to_trim ระบบจะตัดอักขระช่องว่าง

ตัวอย่าง

เมื่อไม่ได้ระบุ values_to_trim

อินพุต trim(input)
" foo " "foo"
b" foo " b"foo"
"foo" "foo"
"" ""
" " ""
"\t foo \n" "foo"
b"\t foo \n" b"foo"
"\r\f\v foo \r\f\v" "foo"
b"\r\f\v foo \r\f\v" b"foo"

เมื่อระบุvalues_to_trim

อินพุต values_to_trim trim(input, values_to_trim)
"abcbfooaacb" "abc" "foo"
"abcdaabadbac" "abc" "daabad"
b"C1C2C3" b"C1" b"C2C3"
b"C1C2" "foo" ข้อผิดพลาด
"foo" b"C1" ข้อผิดพลาด

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("name").trim().as("whitespaceTrimmedName")
  )
);
Swift
let result = try await db.pipeline()
  .collection("books")
  .select([
    Field("name").trim(" \n\t").as("whitespaceTrimmedName")
  ])
  .execute()

Kotlin

val result = db.pipeline()
    .collection("books")
    .select(
        field("name").trim().alias("whitespaceTrimmedName")
    )
    .execute()

Java

Task<Pipeline.Snapshot> result = db.pipeline()
    .collection("books")
    .select(
        field("name").trim().alias("whitespaceTrimmedName")
    )
    .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("name").trim().as_("whitespaceTrimmedName"))
    .execute()
)

SPLIT

ไวยากรณ์:

split(input: STRING) -> ARRAY<STRING>
split[T <: STRING | BYTES](input: T, delimiter: T) -> ARRAY<T>

คำอธิบาย:

แยกค่า STRING หรือ BYTES โดยใช้ตัวคั่น

  • สำหรับ STRING ตัวคั่นเริ่มต้นคือคอมมา , ระบบจะถือว่าตัวคั่นเป็นสตริงเดียว

  • สำหรับ BYTES คุณต้องระบุตัวคั่น

  • การแยกตามตัวคั่นที่ว่างเปล่าจะสร้างอาร์เรย์ของโค้ดพอยต์ Unicode สำหรับค่า STRING และอาร์เรย์ของ BYTES สำหรับค่า BYTES

  • การแยก STRING ที่ว่างเปล่าจะแสดงผล ARRAY ที่มี STRING ว่างเปล่ารายการเดียว

ตัวอย่าง

เมื่อไม่ได้ระบุ delimiter

อินพุต split(input)
"foo,bar,foo" ["foo", "bar", "foo"]
"foo" ["foo"]
",foo," ["", "foo", ""]
"" [""]
b"C120C2C4" ข้อผิดพลาด

เมื่อระบุdelimiter

อินพุต ตัวคั่น split(input, delimiter)
"foo bar foo" " " ["foo", "bar", "foo"]
"foo bar foo" "z" ["foo bar foo"]
"abc" "" ["a", "b", "c"]
b"C1,C2,C4" b"," [b"C1", b"C2", b"C4"]
b"ABC" b"" [b"A", b"B", b"C"]
"foo" b"C1" ข้อผิดพลาด