unique()
Remove the duplicate elements from a list.
Syntax
unique(list)
Parameter
Parameter | Definition |
---|---|
list | PSL list containing elements that shall be returned in a single well-defined (unique) list |
Description
The unique() function returns a well-defined PSL list with all duplicates removed. All elements that remain in the return value appear in the same order as they did in list. If list is the NULL list, the unique() function returns the NULL list; otherwise the unique() function returns a list that is terminated by a new-line character so that all list elements in the list end with a new-line character.
Example
The following is an example of the unique() function:
function main() {
local list;
list = [1,2,3,3,4,5,5,6,6,6,7,8,7,9,7,10];
printf("%s\n",unique(list));
return;
}
local list;
list = [1,2,3,3,4,5,5,6,6,6,7,8,7,9,7,10];
printf("%s\n",unique(list));
return;
}
The printf() function statement prints a PSL list containing the integers 1 through 10.
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*