Choose where you’d like to start

sortKey

Table of Contents

Overview

The sortKey function sorts the keys in a collection containing key-value pairs.

Syntax

<collectionVariable>.sortKey(<booleanValue>);

where,

ParameterData typeDescription
<collectionVariable>COLLECTION

The variable in which key value pairs will be sorted.

<booleanValue>

(optional)

BOOLEAN

Applicable values are true and false.

The value true sorts in ascending(default) order, and the value false sorts in descending order.

In a string list, special characters, upper case, and lower case letters are sorted in the following order:
! " # $ % & ' ( ) * + , - . / <numerical values> : ; < = > ? @ <capital letters> [ ] ^ _ ` <small letters> { | } ~

Examples

 productVersion = collection("Creator" : 5, "CRM" : 2, "Mail" : 8);
 productVersion.sortKey(); // Collection becomes {"CRM":2,"Creator":5,"Mail":8}

Get Started Now

Execute