listSort: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) mNo edit summary |
(Added example) |
||
Line 13: | Line 13: | ||
If sortType is "N", the first number in each entry is effectively padded to 4 digits, so that "Monster3" comes before "Monster11". | If sortType is "N", the first number in each entry is effectively padded to 4 digits, so that "Monster3" comes before "Monster11". | ||
The sortType can have a second character of "+" or "-" to specify an ascending or descending sort. | The sortType can have a second character of "+" or "-" to specify an ascending or descending sort. | ||
|example= | |||
<source lang="mtmacro" line> | |||
[h: UnsortedList = "Monster11,Monster3,Monster12,Monster66,Monster87,Monster71"] | |||
[h: SortedList = listSort(UnsortedList,'N')] | |||
Unsorted list: [r: UnsortedList]<br> | |||
Sorted list: [r: SortedList] | |||
</source> | |||
Returns:<br> | |||
Unsorted list: Monster11,Monster3,Monster12,Monster66,Monster87,Monster71<br> | |||
Sorted list: Monster3, Monster11, Monster12, Monster66, Monster71, Monster87 | |||
}} | }} | ||
[[Category:String List Function]] | [[Category:String List Function]] |
Revision as of 01:38, 25 March 2009
This article is a stub, you can help the RPTools Wiki project by contributing content to expand this article.
listSort() Function
Returns a sorted list.
Usage
[listSort(list, sortType)]
The sortType determines the type of sort to use. If sortType is "A", normal alphabetic sorting is used, and "Monster11" comes before "Monster3". (Default behavior) If sortType is "N", the first number in each entry is effectively padded to 4 digits, so that "Monster3" comes before "Monster11". The sortType can have a second character of "+" or "-" to specify an ascending or descending sort.
Example
[h: UnsortedList = "Monster11,Monster3,Monster12,Monster66,Monster87,Monster71"]
[h: SortedList = listSort(UnsortedList,'N')]
Unsorted list: [r: UnsortedList]<br>
Sorted list: [r: SortedList]
Returns:
Unsorted list: Monster11,Monster3,Monster12,Monster66,Monster87,Monster71