リストを変換する方法 Dartで反復処理なしで文字列に変換するには?質問する

リストを変換する方法 Dartで反復処理なしで文字列に変換するには?質問する

String.join()Dart にはJava や C# のメソッドのようなメソッドがありますか?

入力:

nums: ["20",  "3005",  "2"]

出力:

nums = "2030052"

ベストアンサー1

joinString ではなく List クラスのメソッドです。

List<String> yourList = ["20", "3005", "2"];

// To test that the above the above
yourList.join() == '2030052';     // true
yourList.join(',') == '20,3005,2'; // true, with "," delimiter

おすすめ記事