স্ট্রিং ফাংশন

স্ট্রিং ফাংশন

নাম বিবরণ
BYTE_LENGTH একটি STRING বা BYTES মানের BYTES সংখ্যা প্রদান করে।
CHAR_LENGTH একটি STRING মানের ইউনিকোড অক্ষরের সংখ্যা প্রদান করে।
STARTS_WITH যদি একটি STRING একটি প্রদত্ত উপসর্গ দিয়ে শুরু হয়, তাহলে TRUE প্রদান করে
ENDS_WITH যদি একটি STRING একটি প্রদত্ত পোস্টফিক্স দিয়ে শেষ হয়, তাহলে TRUE প্রদান করে
LIKE যদি একটি STRING একটি প্যাটার্নের সাথে মেলে, তাহলে TRUE প্রদান করে
REGEX_CONTAINS যদি একটি মান একটি নিয়মিত এক্সপ্রেশনের জন্য আংশিক বা পূর্ণ মিল হয়, তাহলে TRUE প্রদান করে।
REGEX_MATCH যদি কোনও মানের কোনও অংশ একটি নিয়মিত অভিব্যক্তির সাথে মেলে, তাহলে TRUE প্রদান করে।
STRING_CONCAT একাধিক STRING একটি STRING এ সংযুক্ত করে
STRING_CONTAINS যদি একটি মানে STRING থাকে, তাহলে TRUE প্রদান করে
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

বর্ণনা:

একটি STRING বা BYTES মানের BYTES সংখ্যা প্রদান করে।

উদাহরণ:

মূল্য byte_length(value)
"এবিসি"
"xyzabc"
খ"abc"
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .select(
    field("title").byteLength().as("titleByteLength")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").byteLength().as("titleByteLength")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("title").byte_length().as_("titleByteLength"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(byteLength(field("title")).as("titleByteLength"))
        .execute()
        .get();

দৈর্ঘ্য

বাক্য গঠন:

char_length(value: STRING) -> INT64

বর্ণনা:

STRING মানে ইউনিকোড কোড পয়েন্টের সংখ্যা প্রদান করে।

উদাহরণ:

মূল্য char_length(value)
"এবিসি"
"হ্যালো"
"বিশ্ব"
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .select(
    field("title").charLength().as("titleCharLength")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").charLength().as("titleCharLength")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("title").char_length().as_("titleCharLength"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(charLength(field("title")).as("titleCharLength"))
        .execute()
        .get();

STARTS_WITH এর সাথে

বাক্য গঠন:

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

বর্ণনা:

যদি value prefix দিয়ে শুরু হয়, তাহলে TRUE প্রদান করে।

উদাহরণ:

মূল্য উপসর্গ starts_with(value, prefix)
"এবিসি" "ক" সত্য
"এবিসি" "খ" মিথ্যা
"এবিসি" "" সত্য
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .select(
    field("title").startsWith("The")
      .as("needsSpecialAlphabeticalSort")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").startsWith("The")
      .as("needsSpecialAlphabeticalSort")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(
        Field.of("title").starts_with("The").as_("needsSpecialAlphabeticalSort")
    )
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(startsWith(field("title"), "The").as("needsSpecialAlphabeticalSort"))
        .execute()
        .get();

ENDS_WITH এর সাথে

বাক্য গঠন:

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

বর্ণনা:

যদি value postfix দিয়ে শেষ হয়, তাহলে TRUE প্রদান করে।

উদাহরণ:

মূল্য পোস্টফিক্স ends_with(value, postfix)
"এবিসি" "গ" সত্য
"এবিসি" "খ" মিথ্যা
"এবিসি" "" সত্য
নোড.জেএস
const result = await db.pipeline()
  .collection("inventory/devices/laptops")
  .select(
    field("name").endsWith("16 inch")
      .as("16InLaptops")
  )
  .execute();
সুইফট
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();
পাইথন
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()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("inventory/devices/laptops")
        .select(endsWith(field("name"), "16 inch").as("16InLaptops"))
        .execute()
        .get();

লাইক

বাক্য গঠন:

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

বর্ণনা:

যদি value pattern সাথে মিলে যায়, তাহলে TRUE প্রদান করে।

উদাহরণ:

মূল্য প্যাটার্ন like(value, pattern)
"অগ্নিকুণ্ড" "অগ্নি%" সত্য
"অগ্নিকুণ্ড" "%স্টোর" সত্য
"ডেটাস্টোর" "ডেটা_টোর" সত্য
"১০০%" "১০০%" সত্য
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .select(
    field("genre").like("%Fiction")
      .as("anyFiction")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("genre").like("%Fiction")
      .as("anyFiction")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("genre").like("%Fiction").as_("anyFiction"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(like(field("genre"), "%Fiction").as("anyFiction"))
        .execute()
        .get();

REGEX_CONTAINS সম্পর্কে

বাক্য গঠন:

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

বর্ণনা:

যদি value কিছু অংশ pattern সাথে মিলে যায়, তাহলে TRUE রিটার্ন করে। যদি pattern একটি বৈধ রেগুলার এক্সপ্রেশন না হয়, তাহলে এই ফাংশনটি একটি error রিটার্ন করে।

রেগুলার এক্সপ্রেশনগুলি re2 লাইব্রেরির সিনট্যাক্স অনুসরণ করে।

উদাহরণ:

মূল্য প্যাটার্ন regex_contains(value, pattern)
"অগ্নিকুণ্ড" "আগুন" সত্য
"অগ্নিকুণ্ড" "স্টোর$" সত্য
"অগ্নিকুণ্ড" "তথ্য" মিথ্যা
নোড.জেএস
const result = await db.pipeline()
  .collection("documents")
  .select(
    field("title").regexContains("Firestore (Enterprise|Standard)")
      .as("isFirestoreRelated")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("documents")
  .select(
    field("title").regexContains("Firestore (Enterprise|Standard)")
      .as("isFirestoreRelated")
  )
);
সুইফট
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();
পাইথন
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()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("documents")
        .select(
            regexContains(field("title"), "Firestore (Enterprise|Standard)")
                .as("isFirestoreRelated"))
        .execute()
        .get();

REGEX_MATCH সম্পর্কে

বাক্য গঠন:

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

বর্ণনা:

যদি value সম্পূর্ণরূপে pattern সাথে মেলে, তাহলে TRUE প্রদান করে। যদি pattern একটি বৈধ রেগুলার এক্সপ্রেশন না হয়, তাহলে এই ফাংশনটি একটি error প্রদান করে।

রেগুলার এক্সপ্রেশনগুলি re2 লাইব্রেরির সিনট্যাক্স অনুসরণ করে।

উদাহরণ:

মূল্য প্যাটার্ন regex_match(value, pattern)
"অগ্নিকুণ্ড" "এফ.*স্টোর" সত্য
"অগ্নিকুণ্ড" "আগুন" মিথ্যা
"অগ্নিকুণ্ড" "^এফ.*ই$" সত্য
নোড.জেএস
const result = await db.pipeline()
  .collection("documents")
  .select(
    field("title").regexMatch("Firestore (Enterprise|Standard)")
      .as("isFirestoreExactly")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("documents")
  .select(
    field("title").regexMatch("Firestore (Enterprise|Standard)")
      .as("isFirestoreExactly")
  )
);
সুইফট
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();
পাইথন
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()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("documents")
        .select(
            regexMatch(field("title"), "Firestore (Enterprise|Standard)")
                .as("isFirestoreExactly"))
        .execute()
        .get();

STRING_CONCAT সম্পর্কে

বাক্য গঠন:

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

বর্ণনা:

দুটি বা ততোধিক STRING মানকে একটি একক ফলাফলে সংযুক্ত করে।

উদাহরণ:

যুক্তি string_concat(values...)
() ত্রুটি
("a") "ক"
("abc", "def") "এবিসিডিএফ"
("a", "", "c") "এসি"
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .select(
    field("title").stringConcat(" by ", field("author"))
      .as("fullyQualifiedTitle")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("title").stringConcat(" by ", field("author"))
      .as("fullyQualifiedTitle")
  )
);
সুইফট
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();
পাইথন
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()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(stringConcat(field("title"), " by ", field("author")).as("fullyQualifiedTitle"))
        .execute()
        .get();

STRING_ধারণ করে

বাক্য গঠন:

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

বর্ণনা:

value আক্ষরিক স্ট্রিং substring আছে কিনা তা পরীক্ষা করে।

উদাহরণ:

মূল্য সাবস্ট্রিং string_contains(value, substring)
"এবিসি" "খ" সত্য
"এবিসি" "ঘ" মিথ্যা
"এবিসি" "" সত্য
"এসি" "।" সত্য
"☃☃☃" "☃" সত্য
নোড.জেএস
const result = await db.pipeline()
  .collection("articles")
  .select(
    field("body").stringContains("Firestore")
      .as("isFirestoreRelated")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("articles")
  .select(
    field("body").stringContains("Firestore")
      .as("isFirestoreRelated")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("articles")
    .select(Field.of("body").string_contains("Firestore").as_("isFirestoreRelated"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("articles")
        .select(stringContains(field("body"), "Firestore").as("isFirestoreRelated"))
        .execute()
        .get();

টো_আপার

বাক্য গঠন:

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

বর্ণনা:

একটি STRING বা BYTES মানকে বড় হাতের অক্ষরে রূপান্তর করে।

যদি একটি বাইট বা অক্ষর UTF-8 ছোট হাতের বর্ণমালার সাথে সঙ্গতিপূর্ণ না হয়, তাহলে এটি অপরিবর্তিতভাবে পাস করা হয়।

উদাহরণ:

মূল্য to_upper(value)
"এবিসি" "এবিসি"
"এবিসি" "এবিসি"
খ"abc" খ"এবিসি"
খ"a1c" খ"A1C"
নোড.জেএস
const result = await db.pipeline()
  .collection("authors")
  .select(
    field("name").toUpper()
      .as("uppercaseName")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("authors")
  .select(
    field("name").toUpper()
      .as("uppercaseName")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("authors")
    .select(Field.of("name").to_upper().as_("uppercaseName"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("authors")
        .select(toUpper(field("name")).as("uppercaseName"))
        .execute()
        .get();

টো_লোয়ার

বাক্য গঠন:

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

বর্ণনা:

একটি STRING বা BYTES মানকে ছোট হাতের অক্ষরে রূপান্তর করে।

যদি একটি বাইট বা অক্ষর UTF-8 বড় হাতের বর্ণমালার অক্ষরের সাথে সঙ্গতিপূর্ণ না হয়, তাহলে এটি অপরিবর্তিতভাবে পাস করা হয়।

উদাহরণ:

মূল্য to_lower(value)
"এবিসি" "এবিসি"
"এবিসি" "এবিসি"
"A1C" "a1c"
খ"এবিসি" খ"abc"
নোড.জেএস
const result = await db.pipeline()
  .collection("authors")
  .select(
    field("genre").toLower().equal("fantasy")
      .as("isFantasy")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("authors")
  .select(
    field("genre").toLower().equal("fantasy")
      .as("isFantasy")
  )
);
সুইফট
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();
পাইথন
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()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("authors")
        .select(equal(toLower(field("genre")), "fantasy").as("isFantasy"))
        .execute()
        .get();

সাবস্ট্রিং

বাক্য গঠন:

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

বর্ণনা:

position থেকে শুরু করে (শূন্য-ভিত্তিক সূচক) এবং সর্বোচ্চ length এন্ট্রি সহ input একটি সাবস্ট্রিং ফেরত পাঠায়। যদি কোনও length প্রদান না করা হয়, তাহলে position থেকে input শেষে সাবস্ট্রিং ফেরত পাঠায়।

  • যদি input STRING মান হয়, তাহলে position এবং length ইউনিকোড কোড পয়েন্টে পরিমাপ করা হয়। যদি এটি BYTES মান হয়, তাহলে সেগুলি বাইটে পরিমাপ করা হয়।

  • যদি position input দৈর্ঘ্যের চেয়ে বেশি হয়, তাহলে একটি খালি সাবস্ট্রিং ফেরত পাঠানো হয়। যদি position প্লাস length input দৈর্ঘ্যের চেয়ে বেশি হয়, তাহলে সাবস্ট্রিংটি input শেষে কেটে ফেলা হয়।

  • যদি position নেতিবাচক হয়, তাহলে অবস্থানটি ইনপুটের শেষ থেকে নেওয়া হবে। যদি নেতিবাচক position ইনপুটের আকারের চেয়ে বড় হয়, তাহলে অবস্থানটি শূন্যে সেট করা হবে। length অবশ্যই অ-ঋণাত্মক হতে হবে।

উদাহরণ:

যখন length প্রদান করা হয় না:

ইনপুট অবস্থান substring(input, position)
"এবিসি" 0 "এবিসি"
"এবিসি" "খ্রিস্টপূর্ব"
"এবিসি" ""
"এবিসি" -১ "গ"
খ"abc" খ"খ"

যখন length প্রদান করা হয়:

ইনপুট অবস্থান দৈর্ঘ্য substring(input, position, length)
"এবিসি" 0 "ক"
"এবিসি" "খ্রিস্টপূর্ব"
"এবিসি" -১ "গ"
খ"abc" 0 খ"ক"
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .where(field("title").startsWith("The "))
  .select(
    field("title").substring(4)
      .as("titleWithoutLeadingThe")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .where(field("title").startsWith("The "))
  .select(
    field("title").substring(4)
      .as("titleWithoutLeadingThe")
  )
);
সুইফট
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();
পাইথন
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()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .where(startsWith(field("title"), "The "))
        .select(
            substring(field("title"), constant(4), field("title").charLength())
                .as("titleWithoutLeadingThe"))
        .execute()
        .get();

STRING_REVERSE এর বিবরণ

বাক্য গঠন:

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

বর্ণনা:

সরবরাহকৃত ইনপুট বিপরীত ক্রমে ফেরত পাঠায়।

যখন ইনপুটটি STRING মান হয় তখন অক্ষরগুলি ইউনিকোড কোড পয়েন্ট দ্বারা চিহ্নিত করা হয় এবং যখন ইনপুটটি BYTES মান হয় তখন বাইটগুলি চিহ্নিত করা হয়।

উদাহরণ:

ইনপুট string_reverse(input)
"এবিসি" "সিবিএ"
"ক🌹খ" "বা"
"হ্যালো" "ওলেহ"
খ"abc" খ"সিবিএ"
নোড.জেএস
const result = await db.pipeline()
  .collection("books")
  .select(
    field("name").reverse().as("reversedName")
  )
  .execute();

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("name").reverse().as("reversedName")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("name").string_reverse().as_("reversedName"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(reverse(field("name")).as("reversedName"))
        .execute()
        .get();

ট্রিম

বাক্য গঠন:

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

বর্ণনা:

সরবরাহকৃত input শুরু এবং শেষ থেকে BYTES বা CHARS একটি নির্দিষ্ট সেট ছাঁটাই করে।

  • যদি কোনও values_to_trim প্রদান না করা হয়, তাহলে হোয়াইটস্পেস অক্ষর ট্রিম করে।

উদাহরণ:

যখন values_to_trim প্রদান করা হয় না:

ইনপুট trim(input)
"ফু" "ফু"
খ" ফু " খ"ফু"
"ফু" "ফু"
"" ""
" " ""
"\t foo \n" "ফু"
b"\t foo \n" খ"ফু"
"\r\f\v foo \r\f\v" "ফু"
খ"\r\f\v foo \r\f\v" খ"ফু"

যখন values_to_trim প্রদান করা হয়:

ইনপুট মান_ছাঁটাই_করুন trim(input, values_to_trim)
"অ্যাবসিবিফুওআকবি" "এবিসি" "ফু"
"আবসিডাআবাদব্যাক" "এবিসি" "দাবাদ"
খ"C1C2C3" খ"গ১" খ"C2C3"
খ"C1C2" "ফু" ত্রুটি
"ফু" খ"গ১" ত্রুটি

Web

const result = await execute(db.pipeline()
  .collection("books")
  .select(
    field("name").trim().as("whitespaceTrimmedName")
  )
);
সুইফট
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();
পাইথন
from google.cloud.firestore_v1.pipeline_expressions import Field

result = (
    client.pipeline()
    .collection("books")
    .select(Field.of("name").trim().as_("whitespaceTrimmedName"))
    .execute()
)
জাভা
Pipeline.Snapshot result =
    firestore
        .pipeline()
        .collection("books")
        .select(trim(field("name")).as("whitespaceTrimmedName"))
        .execute()
        .get();

স্প্লিট

বাক্য গঠন:

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

বর্ণনা:

একটি ডিলিমিটার ব্যবহার করে একটি STRING বা BYTES মান বিভক্ত করে।

  • STRING এর জন্য ডিফল্ট ডিলিমিটার হল কমা , । ডিলিমিটারটিকে একটি একক স্ট্রিং হিসেবে বিবেচনা করা হয়।

  • BYTES এর জন্য, আপনাকে একটি ডিলিমিটার নির্দিষ্ট করতে হবে।

  • একটি খালি ডিলিমিটারে বিভক্ত করলে STRING মানের জন্য ইউনিকোড কোডপয়েন্টের একটি অ্যারে এবং BYTES মানের জন্য BYTES এর একটি অ্যারে তৈরি হয়।

  • একটি খালি STRING বিভক্ত করলে একটি খালি STRING সহ একটি ARRAY ফেরত আসে।

উদাহরণ:

যখন delimiter প্রদান করা হয় না:

ইনপুট split(input)
"ফু,বার,ফু" ["foo", "bar", "foo"]
"ফু" ["ফু"]
",ফু," ["", "foo", ""]
"" [""]
খ"C120C2C4" ত্রুটি

যখন delimiter প্রদান করা হয়:

ইনপুট সীমানা নির্ধারণকারী split(input, delimiter)
"ফু বার ফু" " " ["foo", "bar", "foo"]
"ফু বার ফু" "z" ["ফু বার ফু"]
"এবিসি" "" ["ক", "খ", "গ"]
খ"C1,C2,C4" খ"," [খ"C1", খ"C2", খ"C4"]
খ"এবিসি" খ"" [খ"ক", খ"খ", খ"গ"]
"ফু" খ"গ১" ত্রুটি