Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.31 KB

File metadata and controls

54 lines (37 loc) · 1.31 KB
title titleSuffix description author ms.author ms.reviewer ms.service ms.subservice ms.topic ms.devlang ms.date ms.custom
TRIM
Azure Cosmos DB for NoSQL
An Azure Cosmos DB for NoSQL system function that returns a string with leading or trailing whitespace trimmed.
jcodella
jacodel
sidandrews
cosmos-db
nosql
reference
nosql
02/27/2024
query-reference

TRIM (NoSQL query)

[!INCLUDENoSQL]

Returns a string expression after it removes leading and trailing whitespace or custom characters.

Syntax

TRIM(<string_expr_1> [, <string_expr_2>])

Arguments

Description
string_expr_1 A string expression.
string_expr_2 (Optional) An optional string expression with a string to trim from string_expr_1. If not specified, the default is to trim whitespace.

Return types

Returns a string expression.

Examples

This example illustrates various ways to trim a string expression.

:::code language="nosql" source="~/cosmos-db-nosql-query-samples/scripts/trim/query.sql" highlight="2-9":::

:::code language="json" source="~/cosmos-db-nosql-query-samples/scripts/trim/result.json":::

Remarks

  • This function doesn't use the index.

Related content