c# StringBuilder.Replace 方法 (Char, Char, Int32, Int32)

來源:互聯網
上載者:User

將此執行個體的子字串中所有指定字元的匹配項替換為其他指定字元。

命名空間: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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.