স্ট্রিং ফাংশন
| নাম | বিবরণ |
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" | ৩ |
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() )
দৈর্ঘ্য
বাক্য গঠন:
char_length(value: STRING) -> INT64
বর্ণনা:
STRING মানে ইউনিকোড কোড পয়েন্টের সংখ্যা প্রদান করে।
উদাহরণ:
| মূল্য | char_length(value) |
|---|---|
| "এবিসি" | ৩ |
| "হ্যালো" | ৫ |
| "বিশ্ব" | ৫ |
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() )
STARTS_WITH এর সাথে
বাক্য গঠন:
starts_with(value: STRING, prefix: STRING) -> BOOLEAN
বর্ণনা:
যদি value prefix দিয়ে শুরু হয়, তাহলে TRUE প্রদান করে।
উদাহরণ:
| মূল্য | উপসর্গ | starts_with(value, prefix) |
|---|---|---|
| "এবিসি" | "ক" | সত্য |
| "এবিসি" | "খ" | মিথ্যা |
| "এবিসি" | "" | সত্য |
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() )
ENDS_WITH এর সাথে
বাক্য গঠন:
ends_with(value: STRING, postfix: STRING) -> BOOLEAN
বর্ণনা:
যদি value postfix দিয়ে শেষ হয়, তাহলে TRUE প্রদান করে।
উদাহরণ:
| মূল্য | পোস্টফিক্স | ends_with(value, postfix) |
|---|---|---|
| "এবিসি" | "গ" | সত্য |
| "এবিসি" | "খ" | মিথ্যা |
| "এবিসি" | "" | সত্য |
সুইফট
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() )
লাইক
বাক্য গঠন:
like(value: STRING, pattern: STRING) -> BOOLEAN
বর্ণনা:
যদি value pattern সাথে মিলে যায়, তাহলে TRUE প্রদান করে।
উদাহরণ:
| মূল্য | প্যাটার্ন | like(value, pattern) |
|---|---|---|
| "অগ্নিকুণ্ড" | "অগ্নি%" | সত্য |
| "অগ্নিকুণ্ড" | "%স্টোর" | সত্য |
| "ডেটাস্টোর" | "ডেটা_টোর" | সত্য |
| "১০০%" | "১০০%" | সত্য |
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() )
REGEX_CONTAINS সম্পর্কে
বাক্য গঠন:
regex_contains(value: STRING, pattern: STRING) -> BOOLEAN
বর্ণনা:
যদি value কিছু অংশ pattern সাথে মিলে যায়, তাহলে TRUE রিটার্ন করে। যদি pattern একটি বৈধ রেগুলার এক্সপ্রেশন না হয়, তাহলে এই ফাংশনটি একটি error রিটার্ন করে।
রেগুলার এক্সপ্রেশনগুলি re2 লাইব্রেরির সিনট্যাক্স অনুসরণ করে।
উদাহরণ:
| মূল্য | প্যাটার্ন | regex_contains(value, pattern) |
|---|---|---|
| "অগ্নিকুণ্ড" | "আগুন" | সত্য |
| "অগ্নিকুণ্ড" | "স্টোর$" | সত্য |
| "অগ্নিকুণ্ড" | "তথ্য" | মিথ্যা |
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() )
REGEX_MATCH সম্পর্কে
বাক্য গঠন:
regex_match(value: STRING, pattern: STRING) -> BOOLEAN
বর্ণনা:
যদি value সম্পূর্ণরূপে pattern সাথে মেলে, তাহলে TRUE প্রদান করে। যদি pattern একটি বৈধ রেগুলার এক্সপ্রেশন না হয়, তাহলে এই ফাংশনটি একটি error প্রদান করে।
রেগুলার এক্সপ্রেশনগুলি re2 লাইব্রেরির সিনট্যাক্স অনুসরণ করে।
উদাহরণ:
| মূল্য | প্যাটার্ন | regex_match(value, pattern) |
|---|---|---|
| "অগ্নিকুণ্ড" | "এফ.*স্টোর" | সত্য |
| "অগ্নিকুণ্ড" | "আগুন" | মিথ্যা |
| "অগ্নিকুণ্ড" | "^এফ.*ই$" | সত্য |
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() )
STRING_CONCAT সম্পর্কে
বাক্য গঠন:
string_concat(values: STRING...) -> STRING
বর্ণনা:
দুটি বা ততোধিক STRING মানকে একটি একক ফলাফলে সংযুক্ত করে।
উদাহরণ:
| যুক্তি | string_concat(values...) |
|---|---|
() | ত্রুটি |
("a") | "ক" |
("abc", "def") | "এবিসিডিএফ" |
("a", "", "c") | "এসি" |
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() )
STRING_ধারণ করে
বাক্য গঠন:
string_contains(value: STRING, substring: STRING) -> BOOLEAN
বর্ণনা:
value আক্ষরিক স্ট্রিং substring আছে কিনা তা পরীক্ষা করে।
উদাহরণ:
| মূল্য | সাবস্ট্রিং | string_contains(value, substring) |
|---|---|---|
| "এবিসি" | "খ" | সত্য |
| "এবিসি" | "ঘ" | মিথ্যা |
| "এবিসি" | "" | সত্য |
| "এসি" | "।" | সত্য |
| "☃☃☃" | "☃" | সত্য |
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() )
টো_আপার
বাক্য গঠন:
to_upper[T <: STRING | BYTES](value: T) -> T
বর্ণনা:
একটি STRING বা BYTES মানকে বড় হাতের অক্ষরে রূপান্তর করে।
যদি একটি বাইট বা অক্ষর UTF-8 ছোট হাতের বর্ণমালার সাথে সঙ্গতিপূর্ণ না হয়, তাহলে এটি অপরিবর্তিতভাবে পাস করা হয়।
উদাহরণ:
| মূল্য | to_upper(value) |
|---|---|
| "এবিসি" | "এবিসি" |
| "এবিসি" | "এবিসি" |
| খ"abc" | খ"এবিসি" |
| খ"a1c" | খ"A1C" |
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() )
টো_লোয়ার
বাক্য গঠন:
to_lower[T <: STRING | BYTES](value: T) -> T
বর্ণনা:
একটি STRING বা BYTES মানকে ছোট হাতের অক্ষরে রূপান্তর করে।
যদি একটি বাইট বা অক্ষর UTF-8 বড় হাতের বর্ণমালার অক্ষরের সাথে সঙ্গতিপূর্ণ না হয়, তাহলে এটি অপরিবর্তিতভাবে পাস করা হয়।
উদাহরণ:
| মূল্য | to_lower(value) |
|---|---|
| "এবিসি" | "এবিসি" |
| "এবিসি" | "এবিসি" |
| "A1C" | "a1c" |
| খ"এবিসি" | খ"abc" |
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() )
সাবস্ট্রিং
বাক্য গঠন:
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 শেষে সাবস্ট্রিং ফেরত পাঠায়।
যদি
inputSTRINGমান হয়, তাহলেpositionএবংlengthইউনিকোড কোড পয়েন্টে পরিমাপ করা হয়। যদি এটিBYTESমান হয়, তাহলে সেগুলি বাইটে পরিমাপ করা হয়।যদি
positioninputদৈর্ঘ্যের চেয়ে বেশি হয়, তাহলে একটি খালি সাবস্ট্রিং ফেরত পাঠানো হয়। যদিpositionপ্লাসlengthinputদৈর্ঘ্যের চেয়ে বেশি হয়, তাহলে সাবস্ট্রিংটিinputশেষে কেটে ফেলা হয়।যদি
positionনেতিবাচক হয়, তাহলে অবস্থানটি ইনপুটের শেষ থেকে নেওয়া হবে। যদি নেতিবাচকpositionইনপুটের আকারের চেয়ে বড় হয়, তাহলে অবস্থানটি শূন্যে সেট করা হবে।lengthঅবশ্যই অ-ঋণাত্মক হতে হবে।
উদাহরণ:
যখন length প্রদান করা হয় না:
| ইনপুট | অবস্থান | substring(input, position) |
|---|---|---|
| "এবিসি" | 0 | "এবিসি" |
| "এবিসি" | ১ | "খ্রিস্টপূর্ব" |
| "এবিসি" | ৩ | "" |
| "এবিসি" | -১ | "গ" |
| খ"abc" | ১ | খ"খ" |
যখন length প্রদান করা হয়:
| ইনপুট | অবস্থান | দৈর্ঘ্য | substring(input, position, length) |
|---|---|---|---|
| "এবিসি" | 0 | ১ | "ক" |
| "এবিসি" | ১ | ২ | "খ্রিস্টপূর্ব" |
| "এবিসি" | -১ | ১ | "গ" |
| খ"abc" | 0 | ১ | খ"ক" |
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() )
STRING_REVERSE এর বিবরণ
বাক্য গঠন:
string_reverse[T <: STRING | BYTES](input: T) -> T
বর্ণনা:
সরবরাহকৃত ইনপুট বিপরীত ক্রমে ফেরত পাঠায়।
যখন ইনপুটটি STRING মান হয় তখন অক্ষরগুলি ইউনিকোড কোড পয়েন্ট দ্বারা চিহ্নিত করা হয় এবং যখন ইনপুটটি BYTES মান হয় তখন বাইটগুলি চিহ্নিত করা হয়।
উদাহরণ:
| ইনপুট | string_reverse(input) |
|---|---|
| "এবিসি" | "সিবিএ" |
| "ক🌹খ" | "বা" |
| "হ্যালো" | "ওলেহ" |
| খ"abc" | খ"সিবিএ" |
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() )
ট্রিম
বাক্য গঠন:
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() )
স্প্লিট
বাক্য গঠন:
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"] |
| খ"এবিসি" | খ"" | [খ"ক", খ"খ", খ"গ"] |
| "ফু" | খ"গ১" | ত্রুটি |