Created
October 18, 2016 21:18
-
-
Save vmwarecode/50722bbe100b03fbf9b7590be3719a0e to your computer and use it in GitHub Desktop.
Combine and sort two string arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // 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