append()

本参考资料用于Processing 3.0+。 如果你使用的是前一版本,请在使用软件帮助菜单内的参考资料。. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

名称

append()

示例
 String[] sa1 ={ "OH", "NY", "CA"  };

 String[] sa2 = append(sa1, "MA");

println(sa2);

// Prints updated array contents to the console: // [0] "OH" // [1] "NY" // [2] "CA" // [3] "MA" 
描述 Expands an array by one element and adds data to the new position. The datatype of the element parameter must be the same as the datatype of the array.

When using an array of objects, the data returned from the function must be cast to the object array’s data type. For example: SomeClass[] items = (SomeClass[]) append(originalArray, element)

语法
append(array, value)
参数
array Object, String[],float[],
int[], char[], or byte[]: array to append
value Object, String,float, int, char, or byte: new data for the array
返回值 byte[], char[],
int[],float[], String[], or Object
相关 shorten()
expand()

Updated on October 2, 2018 05:02:07pm EDT

append()