首页 > 文档 > append()添加数据
2017
07-21

append()添加数据

Name

append()添加数据

   

Examples

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”

Description

Expands an array by one element and adds data to the new position. The datatype of the elementparameter 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)

按一个元素展开数组, 并将数据添加到新位置。elementparameter 的数据类型必须与数组的数据类型相同。

 

当使用对象数组时, 从函数返回的数据必须转换为对象数组的数据类型。例如: SomeClass [] = (SomeClass []) 追加 (originalArray, 元素)

Syntax

append(array, value)

Parameters

array

Object, String[], float[], int[], char[], or byte[]: array to append要追加的数组

value

Object, String, float, int, char, or byte: new data for the array数组的新值

Returns

byte[], char[], int[], float[], String[], or Object

Related

shorten()
expand()



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。