REPLACE (Azure Cosmos DB)REPLACE (Azure Cosmos DB)

将出现的所有指定字符串值替换为另一个字符串值。Replaces all occurrences of a specified string value with another string value.

语法Syntax

REPLACE(<str_expr1>, <str_expr2>, <str_expr3>)  

参数Arguments

str_expr1str_expr1
是要搜索的字符串表达式。Is the string expression to be searched.

str_expr2str_expr2
要找到的字符串表达式。Is the string expression to be found.

str_expr3str_expr3
是用于替换 str_expr1 中的 str_expr2 匹配项的字符串表达式。Is the string expression to replace occurrences of str_expr2 in str_expr1.

返回类型Return types

返回一个字符串表达式。Returns a string expression.

示例Examples

以下示例演示如何在查询中使用 REPLACEThe following example shows how to use REPLACE in a query.

SELECT REPLACE("This is a Test", "Test", "desk") AS replace 

下面是结果集。Here is the result set.

[{"replace": "This is a desk"}]  

备注Remarks

此系统函数不会使用索引。This system function will not utilize the index.

后续步骤Next steps