Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 1.75 KB

File metadata and controls

86 lines (63 loc) · 1.75 KB

zpe.lib.sort

This is the official Sorting plugin for ZPE.

The plugin provides flexible and stable sorting functions for lists and maps, including numeric sorting, string sorting, natural sorting, and sorting by key.

Installation

Place zpe.lib.sort.jar in your ZPE native-plugins folder and restart ZPE.

You can also download with the ZULE Package Manager by using:

zpe --zule install zpe.lib.sort.jar

Documentation

Full documentation, examples and API reference are available here:

View the complete documentation

Example

import "zpe.lib.sort"

numbers = [5, 2, 10, 1]
print(sort(numbers))

names = ["ZPE", "apple", "Banana"]
print(sort(names, "string_ci"))

rows = [
  [=>]{"name":"Jamie","age":34},
  [=>]{"name":"Alice","age":12},
  [=>]{"name":"Bob","age":12}
]

sorted = sort_by(rows, "age", "number")
print(sorted)

Available Functions

  • sort – Sort a list.
  • sort_by – Sort a list of maps by key.
  • sort_map_keys – Return sorted map keys.
  • sort_map_values – Return sorted map values.

Sorting Modes

  • "auto" (default)
  • "number"
  • "string"
  • "string_ci"
  • "natural"

Notes

  • Sorting is stable.
  • Original data structures are not modified.
  • Cross-platform (Windows, macOS, Linux).