Dart-programming-string-split-method

提供:Dev Guides
移動先:案内検索

String split()メソッド

指定された区切り文字の一致で文字列を分割し、部分文字列のリストを返します。

構文

split(Pattern pattern)

パラメーター

  • pattern -区切り文字を表します。

戻りタイプ

Stringオブジェクトのリストを返します。

void main() {
   String str1 = "Today, is, Thursday";
   print("New String: ${str1.split(',')}");
}

次の output -が生成されます。

New String: [Today,  is,  Thursday]