字串分割



按照指定的定界符分割字串,並返回子字串的列表。

語法

split(Pattern pattern)

引數

  • pattern − 表示定界符。

返回型別

返回字串物件的列表。

示例

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

將生成以下 輸出 −。

New String: [Today,  is,  Thursday]
dart_programming_string.htm
廣告
© . All rights reserved.