2008-08-24 16 views

答えて

17

なぜ:

string s = "foobar\ngork"; 
string v = s.Replace(Environment.NewLine,","); 
System.Console.WriteLine(v); 
0

最も良い方法は組み込みの方法です。string.Replaceを使用してください。なぜ代替案が必要ですか?

2
string sample = "abc" + Environment.NewLine + "def"; 
string replaced = sample.Replace(Environment.NewLine, ","); 
2

車輪の再発明をしないでください - ちょうどこのよう

7

myString.Replace(Environment.NewLineを、 "")を使用します。

string s = "hello\nworld"; 
s = s.Replace(Environment.NewLine, ","); 
関連する問題