Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know.
If you prefer a more technical reference, visit the Processing Javadoc.
Name |
sort() |
Examples |
float[] a = { 3.4, 3.6, 2, 0, 7.1 };
a = sort(a);
println(a);
String[] s = { "deer", "elephant", "bear", "aardvark", "cat" };
s = sort(s);
println(s); // Prints aardvark, bear, cat, deer, elephant on separate lines
String[] s = { "deer", "elephant", "bear", "aardvark", "cat" };
s = sort(s, 3);
println(s); // Prints bear, dear, elephant, aardvark, cat on separate lines |
Description |
Sorts an array of numbers from smallest to largest and puts an array of words in alphabetical order. The original array is not modified, a re-ordered array is returned. The count parameter states the number of elements to sort. For example if there are 12 elements in an array and if count is the value 5, only the first five elements on the array will be sorted. As of release 0126, the alphabetical ordering is case insensitive. |
Syntax |
sort(dataArray)
sort(dataArray, count) |
Parameters |
dataArray |
String[], int[], or float[] |
count |
int |
|
Returns |
Array (same datatype as the input) |
Usage |
Web & Application |
Related |
reverse()
|
Updated on June 14, 2010 12:05:29pm EDT