Skip to content

Instantly share code, notes, and snippets.

@vmwarecode
Created October 18, 2016 21:18
Show Gist options
  • Select an option

  • Save vmwarecode/50722bbe100b03fbf9b7590be3719a0e to your computer and use it in GitHub Desktop.

Select an option

Save vmwarecode/50722bbe100b03fbf9b7590be3719a0e to your computer and use it in GitHub Desktop.
Combine and sort two string arrays
//
// VMware vRealize Orchestrator action sample
//
// - Combines two arrays of strings
// - Removes duplicate entries
// - Alphabetically sorts the array
//
//Action Inputs:
// array1 - Array/string
// array2 - Array/string
//
//Return type: Array/string
var arrays = [array1,array2];
var index = new Properties();
for (var i in arrays) {
var item = arrays[i];
for (var j in item) {
index.put(item[j],true);
}
}
return index.keys.sort();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment