c# StringBuilder.Replace 方法 (Char, Char, Int32, Int32)
更新时间:2007年08月18日 22:49:04 作者:
将此实例的子字符串中所有指定字符的匹配项替换为其他指定字符。
命名空间: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
命名空间: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
您可能感兴趣的文章:
相关文章
C#难点逐个击破(6):C#数据类型与.net framework数据类型
最近开始看Illustrator C#2008,这真是一本好书,我读计算机书籍这么多了,能让我称为好书的没有多少。2010-02-02DevExpress GridControl实现根据RowIndex和VisibleColumnsIndex来获取单元格
这篇文章主要介绍了DevExpress GridControl实现根据RowIndex和VisibleColumnsIndex来获取单元格值,需要的朋友可以参考下2014-08-08C# PictureBox控件方法参数及图片删除重命名上传详解
这篇文章主要为大家介绍了C# PictureBox控件方法参数及图片删除重命名上传示例详解,有需要的朋友可以借鉴参考下,希望能够有所帮助,祝大家多多进步,早日升职加薪2022-08-08
最新评论