c# StringBuilder.Replace 方法 (Char, Char, Int32, Int32)
时间:2022-02-27 06:53:11
将此实例的子字符串中所有指定字符的匹配项替换为其他指定字符。
命名空间:System.Text
程序集:mscorlib(在 mscorlib.dll 中)
语法
C#
public StringBuilder Replace (
char oldChar,
char newChar,
int startIndex,
int count
)
参数
oldChar
要替换的字符。
newChar
替换 oldChar 的字符。
startIndex
此实例中子字符串开始的位置。
count
子字符串的长度。
返回值
对此实例的引用,其中从 startIndex 到 startIndex + count -1 范围内的 oldChar 被 newChar 替换。
异常
异常类型 条件
ArgumentOutOfRangeException
startIndex+count 大于此实例值的长度。
- 或 -
startIndex 或 count 小于零。
备注
StringBuilder 的大小不变,这是因为只是替换字符。此方法区分大小写。
平台
Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、
Windows Mobile for Pocket PC、Windows Mobile for Smartphone、
Windows Server 2003、Windows XP Media Center Edition、
Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Java开发SpringBoot集成接口文档实现示例
![](https://img.aspxhome.com/file/2023/6/69326_0s.jpg)
Java设计模式之命令模式详解
Spring如何使用注解的方式创建bean
Java读取properties文件之中文乱码问题及解决
![](https://img.aspxhome.com/file/2023/1/73051_0s.jpg)
基于jdk1.8的Java源码详解 Integer
![](https://img.aspxhome.com/file/2023/8/68158_0s.jpg)
详解Java的Spring框架中的事务管理方式
详解springboot测试类注解
![](https://img.aspxhome.com/file/2023/6/71246_0s.png)
java实现人员信息管理系统
![](https://img.aspxhome.com/file/2023/5/58425_0s.jpg)
Opencv EigenFace人脸识别算法详解
![](https://img.aspxhome.com/file/2023/5/101075_0s.png)
List调用toString()方法后,去除两头的中括号实例
深入理解Java设计模式之外观模式
![](https://img.aspxhome.com/file/2023/2/68562_0s.jpg)
Spring5中的WebClient使用方法详解
详解SpringBoot+SpringSecurity+jwt整合及初体验
![](https://img.aspxhome.com/file/2023/3/60373_0s.png)
Spring创建bean对象三种方式代码实例
![](https://img.aspxhome.com/file/2023/6/70526_0s.png)
基于Java实现Json文件转换为Excel文件
如何创建SpringBoot项目
![](https://img.aspxhome.com/file/2023/7/68167_0s.png)
完美解决单例设计模式中懒汉式线程安全的问题
关于JWT之token令牌认证登录
![](https://img.aspxhome.com/file/2023/8/69918_0s.png)
Java编程实现A*算法完整代码
![](https://img.aspxhome.com/file/2023/1/72591_0s.png)