首页 > 文档 > StringList字符串列表类
2017
07-20

StringList字符串列表类

Name

StringList字符串列表类

Examples

StringList inventory;

 

void setup() {

size(200, 200);

inventory = new StringList();

inventory.append(“coffee”);

inventory.append(“flour”);

inventory.append(“tea”);

println(inventory);

noLoop();

fill(0);

textAlign(CENTER);

}

 

void draw() {

String item = inventory.get(2);

text(item, width/2, height/2);

}

Description

Helper class for a list of Strings. Lists are designed to have some of the features of ArrayLists, but to maintain the simplicity and efficiency of working with arrays.

Functions like sort() and shuffle() always act on the list itself. To get a sorted copy, use list.copy().sort().

字符串列表的帮助器类。列表被设计为具有 ArrayLists 的一些功能, 但要保持使用数组的简单性和效率。

 

排序 () 和无序 () 之类的函数总是在列表本身上执行。若要获取已排序的副本, 请使用列表. 复制 (). 排序 ()

Methods

size()

Get the length of the list

获取列表的长度

clear()

Remove all entries from the list

清空表

get()

Get an entry at a particular index

获取特定索引处的条目

set()

Set an entry at a particular index

在特定索引处设置条目

remove()

Remove an element from the specified index

在特定索引处移除条目

append()

Add a new entry to the list

向列表中添加新项

hasValue()

Check if a value is a part of the list

检查数字是否为列表的一部分

sort()

Sorts the array in place排序

sortReverse()

Reverse sort, orders values from highest to lowest反向排序

reverse()

Reverse the order of the list elements

反转列表元素的顺序

shuffle()

Randomize the order of the list elements

随机化列表元素的顺序

lower()

Make the entire list lower case

使整个列表更低

upper()

Make the entire list upper case

使整个列表更高

array()

Create a new array with a copy of all the values

创建一个包含所有值的副本的新数组

Constructor

StringList()

StringList(items)

Related

IntList
FloatList



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

留下一个回复

你的email不会被公开。