首页 > 文档 > shorten()缩短数组
2017
07-21

shorten()缩短数组

Name

shorten()缩短数组

   

Examples

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

String[] sa2 = shorten(sa1);

println(sa1); // ‘sa1’ still contains OH, NY, CA

println(sa2); // ‘sa2’ now contains OH, NY

Description

Decreases an array by one element and returns the shortened 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[]) shorten(originalArray)

将数组减少一个元素, 并返回缩短的数组。

 

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

Syntax

shorten(list)

Parameters

list

Object, String[], float[], int[], char[], byte[], or boolean[]: array to shorten

Returns

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

Related

append()
expand()



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

留下一个回复

你的email不会被公开。