首页 > 文档 > concat()串联两个数组
2017
07-21

concat()串联两个数组

Name

concat()串联两个数组

   

Examples

String[] sa1 = { “OH”, “NY”, “CA”};

String[] sa2 = { “KY”, “IN”, “MA”};

String[] sa3 = concat(sa1, sa2);

println(sa3);

// Prints updated array contents to the console:

// [0] “OH”

// [1] “NY”

// [2] “CA”

// [3] “KY”

// [4] “IN”

// [5] “MA”

Description

Concatenates two arrays. For example, concatenating the array { 1, 2, 3 } and the array { 4, 5, 6 } yields { 1, 2, 3, 4, 5, 6 }. Both parameters must be arrays of the same datatype. 

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[]) concat(array1, array2).

串联两个数组。例如, 串联阵列 {123} 和阵列 {456} 生成 {123456}。两个参数都必须是同一数据类型的数组。

 

当使用对象数组时, 从函数返回的数据必须转换为对象数组的数据类型。例如: SomeClass [] 项目 = (SomeClass []) concat (array1, array2)

Syntax

concat(a, b)

Parameters

a

Object, String[], float[], int[], char[], byte[], or boolean[]: first array to concatenate第一个串联数组

b

Object, String[], float[], int[], char[], byte[], or boolean[]: second array to concatenate第二个串联数组

Returns

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

Related

splice()
arrayCopy()



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

留下一个回复

你的email不会被公开。