C#文字列Replace
Remove

Replace文字列

Split

一致するすべての文字列を置換します。

構文

str.Replace(oldValue, newValue)

使用例

下記の値を入力するとサンプルに即時反映されます。

string
result
Console
WriteLine
string text = "Hello World World";
string result = text.Replace("World", "C#");
Console.WriteLine(result);   // "Hello C# C#"