Processing, subset()
用法介紹。
用法
subset(list, start)
subset(list, start, count)
參數
list
(boolean[], Object, byte[], char[], int[], long[], float[], double[], String[])
要從中提取的數組start
(int)
開始的位置count
(int)
要提取的值的數量
返回
boolean[], byte[], char[], int[], long[], float[], double[], String[], or Object
說明
從現有數組中提取元素數組。 list
參數定義要從中複製元素的數組,start
和 count
參數指定要提取的元素。如果沒有給出count
,則將從start
中提取元素到數組的末尾。指定 start
時,請記住第一個數組元素為 0。此函數不會更改源數組。
使用對象數組時,函數返回的數據必須轉換為對象數組的數據類型。例如:SomeClass[] items =
(SomeClass[]) subset(originalArray, 0, 4)
例子
String[] sa1 = { "OH", "NY", "CA", "VA", "CO", "IL" };
String[] sa2 = subset(sa1, 1);
println(sa2);
// Prints the following array contents to the console:
// [0] "NY"
// [1] "CA"
// [2] "VA"
// [3] "CO"
// [4] "IL"
println();
String[] sa3 = subset(sa1, 2, 3);
println(sa3);
// Prints the following array contents to the console:
// [0] "CA"
// [1] "VA"
// [2] "CO"
有關的
相關用法
- Processing super用法及代碼示例
- Processing scale()用法及代碼示例
- Processing splice()用法及代碼示例
- Processing saveJSONArray()用法及代碼示例
- Processing strokeJoin()用法及代碼示例
- Processing saveXML()用法及代碼示例
- Processing switch用法及代碼示例
- Processing sqrt()用法及代碼示例
- Processing serverEvent()用法及代碼示例
- Processing save()用法及代碼示例
- Processing saveStrings()用法及代碼示例
- Processing saveTable()用法及代碼示例
- Processing shorten()用法及代碼示例
- Processing saturation()用法及代碼示例
- Processing settings()用法及代碼示例
- Processing spotLight()用法及代碼示例
- Processing setLocation()用法及代碼示例
- Processing splitTokens()用法及代碼示例
- Processing setResizable()用法及代碼示例
- Processing specular()用法及代碼示例
- Processing sphere()用法及代碼示例
- Processing setup()用法及代碼示例
- Processing shape()用法及代碼示例
- Processing smooth()用法及代碼示例
- Processing sin()用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 subset()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。