---
title: StringReplaceAll
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/TensorFlowCommunity/latest/Convergence/tfscopedevg/atlassfpapi_07_0189.html
sourcePath: /source/zh/TensorFlowCommunity/910/Convergence/tfscopedevg/atlassfpapi_07_0189.html
indexId: 9d1eee14c62dda55ddec4fcc71abecc67530140f87659a2383a859388c1d3c0b83
---
# StringReplaceAll

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Ascend 950PR / Ascend 950DT | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |


#### 函数功能

将字符串str中包含old_value的字符串用new_value替换。


#### 函数原型

数据类型为string的接口后续版本会废弃，建议使用数据类型为非string的接口。


```
static std::string StringReplaceAll(std::string str, const std::string &old_value, const std::string &new_value);
static AscendString StringReplaceAll(const char_t *str, const char_t *old_value, const char_t *new_value);
```


#### 参数说明

| 参数名 | 输入/输出 | 描述 |
| --- | --- | --- |
| str | 输入 | 待处理的源字符串 |
| old\_value | 输入 | 待替换的字符串 |
| new\_value | 输入 | 用来替换old\_value的字符串 |


#### 返回值

| 参数名 | 描述 |
| --- | --- |
| \- | 替换后的新字符串 |


#### 约束说明

无。
