c# StringBuilder.Replace 方法 (Char, Char, Int32, Int32)_C#教程-查字典教程网
c# StringBuilder.Replace 方法 (Char, Char, Int32, Int32)
c# StringBuilder.Replace 方法 (Char, Char, Int32, Int32)
发布时间:2016-12-28 来源:查字典编辑
摘要:将此实例的子字符串中所有指定字符的匹配项替换为其他指定字符。命名空间:System.Text程序集:mscorlib(在mscorlib.d...

将此实例的子字符串中所有指定字符的匹配项替换为其他指定字符。

命名空间:System.Text

程序集:mscorlib(在mscorlib.dll中)

语法

C#

publicStringBuilderReplace(

charoldChar,

charnewChar,

intstartIndex,

intcount

)

参数

oldChar

要替换的字符。

newChar

替换oldChar的字符。

startIndex

此实例中子字符串开始的位置。

count

子字符串的长度。

返回值

对此实例的引用,其中从startIndex到startIndex+count-1范围内的oldChar被newChar替换。

异常

异常类型条件

ArgumentOutOfRangeException

startIndex+count大于此实例值的长度。

-或-

startIndex或count小于零。

备注

StringBuilder的大小不变,这是因为只是替换字符。此方法区分大小写。

平台

Windows98、Windows2000SP4、WindowsCE、WindowsMillenniumEdition、

WindowsMobileforPocketPC、WindowsMobileforSmartphone、

WindowsServer2003、WindowsXPMediaCenterEdition、

WindowsXPProfessionalx64Edition、WindowsXPSP2、WindowsXPStarterEdition

.NETFramework并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。

版本信息

.NETFramework

受以下版本支持:2.0、1.1、1.0

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新C#教程学习
    热门C#教程学习
    编程开发子分类