arraynumericsort(
ARRAY
,
SEPARATOR
)

The arraynumericsort( function sorts a text array in numeric order (see Text Arrays).


Parameters

This function has two parameters:

array – the text array that you want to sort. The items in this text array should contain numeric values at the start of the items. This function works with any kind of number: positive or negative, integer or fractional – even numbers expressed in scientific notation. The number must be at the very start of the item. If there is any other character or characters in front of the number the item will be sorted as zero. There must not be any punctuation within the number itself: no commas, spaces, currency symbols, etc. There can, however, be any sort of text after the numeric value, it will ignored as far as the sorting goes.

separator – the separator character for this array.


Description

This function is designed to sort text arrays that contain numeric values, or a combination of numeric and text values. In its simplest form, you can use it to simply sort an array that contains only integer values.

arraynumericsort("373,98,7,49,1983",",") ☞ 7,49,98,373,1983

The numbers can be negative and/or non-integer values.

arraynumericsort("3.73,2.9,7,-9,12,3.14159",",") ☞ -9,2.9,3.14159,3.73,7,12

Or they can even contain numbers in scientific notation. This example has a mix of scientific and regular notation.

arraynumericsort("4.35e5,2.19e5,6.792e2,45.67",",") ☞ 45.67,6.792e2,2.19e5,4.35e5

The array items can contain additional text after the number, but it will be ignored as far as sorting goes.

arraynumericsort("32 red,10 white,5 blue",",") ☞ 5 blue,10 white,32 red

If the array contains any items that don’t have any numeric value at all, they will be sorted as zero, which will put them at the front of the array unless the array contains negative values.

arraynumericsort("32 red,10 white,10 black,gold,blue",",")
    ☞ gold,blue,10 white,10 black,32 red

See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0, however, this is now a native function instead of being implemented with the call( function. It's much faster and more robust than it was in Panorama 6.0. In addition, the arrayintegersort( function is now identical to the arraynumericsort( function.