REPLICATE (Azure Cosmos DB)REPLICATE (Azure Cosmos DB)

将一个字符串值重复指定的次数。Repeats a string value a specified number of times.

语法Syntax

REPLICATE(<str_expr>, <num_expr>)

参数Arguments

str_exprstr_expr
是一个字符串表达式。Is a string expression.

num_exprnum_expr
是一个数值表达式。Is a numeric expression. 如果 num_expr 为负或非有限,则结果未定义。If num_expr is negative or non-finite, the result is undefined.

返回类型Return types

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

备注Remarks

结果的最大长度为 10,000 个字符,即 (length(str_expr) * num_expr) <= 10,000。The maximum length of the result is 10,000 characters i.e. (length(str_expr) * num_expr) <= 10,000.

示例Examples

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

SELECT REPLICATE("a", 3) AS replicate

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

[{"replicate": "aaa"}]

备注Remarks

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

后续步骤Next steps