1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

文字の連結

1
Posted at

string.joinで可能
任意の繋ぎで連結可能
nullや""など空白の場合は繋ぎなしで連結可能
いちいちStringBuilderを使って連結していたがそれ以外の方法が分かった
速度は知らん
この程度の量なら問題ないと思うが

サンプル

var str1 = string.join("-",Enumerable.Range(1, 10));
//出力:1-2-3-4-5-6-7-8-9-10
var str2 = string.join("",Enumerable.Range(1, 10));
//出力:12345678910
 var str3 = string.Join(null, Enumerable.Range(9, 10).Select(v => v.ToString("X2")));
//出力:090A0B0C0D0E0F101112
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?