
- Dart 程式設計教程
- Dart 程式設計 - 主頁
- Dart 程式設計 - 概覽
- Dart 程式設計 - 環境
- Dart 程式設計 - 語法
- Dart 程式設計 - 資料型別
- Dart 程式設計 - 變數
- Dart 程式設計 - 運算子
- Dart 程式設計 - 迴圈
- Dart 程式設計 - 決策
- Dart 程式設計 - 數字
- Dart 程式設計 - 字串
- Dart 程式設計 - 布林值
- Dart 程式設計 - 列表
- Dart 程式設計 - 列表
- Dart 程式設計 - 對映
- Dart 程式設計 - 符號
- Dart 程式設計 - 字串
- Dart 程式設計 - 列舉
- Dart 程式設計 - 函式
- Dart 程式設計 - 介面
- Dart 程式設計 - 類
- Dart 程式設計 - 物件
- Dart 程式設計 - 集合
- Dart 程式設計 - 泛型
- Dart 程式設計 - 包
- Dart 程式設計 - 異常
- Dart 程式設計 - 除錯
- Dart 程式設計 - 型別定義
- Dart 程式設計 - 庫
- Dart 程式設計 - 非同步
- Dart 程式設計 - 併發
- Dart 程式設計 - 單元測試
- Dart 程式設計 - HTML DOM
- Dart 程式設計有用資源
- Dart 程式設計 - 快速指南
- Dart 程式設計 - 資源
- Dart 程式設計 - 討論
List.replaceRange() 函式
Dart:core 庫中的 List 類提供 replaceRange() 函式來修改 List 項。此函式替換指定範圍內元素的值。
List.replaceRange() 函式使用的語法如下所示 −
List.replaceRange(int start_index,int end_index,Iterable <items>)
其中,
Start_index − 表示開始替換的索引位置的整數。
End_index − 表示停止替換的索引位置的整數。
<items> − 表示更新值的迭代物件。
以下 示例對此進行了說明 −
void main() { List l = [1, 2, 3,4,5,6,7,8,9]; print('The value of list before replacing ${l}'); l.replaceRange(0,3,[11,23,24]); print('The value of list after replacing the items between the range [0-3] is ${l}'); }
它應產生以下 輸出 −
The value of list before replacing [1, 2, 3, 4, 5, 6, 7, 8, 9] The value of list after replacing the items between the range [0-3] is [11, 23, 24, 4, 5, 6, 7, 8, 9]
dart_programming_lists_basic_operations.htm
廣告