next up previous
Next: CHR_SWAP - Swap two single-character variables
Up: Routine Descriptions
Previous: CHR_SKCHR - Skip over all specified characters in a string

CHR_SORT  -  Sort an array of character variables into alphabetical order

Description:
Sort an array of character variables into alphabetical order using the collating sequence provided by the routine CHR_SCOMP. After the sort, a search is made to remove any values which occur more than once. The total number of unique values is returned.

Invocation:
CALL CHR_SORT( CHR_SCOMP, MXARY, ARRAY, NSORT )

Arguments:
CHR_SCOMP = LOGICAL FUNCTION (Given)
An external function which compares two character strings and returns whether the first string is less than the second.
MXARY = INTEGER (Given)
The number of character values to sort.
ARRAY( MXARY ) = CHARACTER ( ) (Given and Returned)
The array of character values to be sorted.
NSORT = INTEGER (Returned)
The number of unique character values returned.

Notes:
To use this subroutine it is necessary to declare the function CHR_SCOMP, or its equivalent, to be EXTERNAL in the calling routine.



next up previous
Next: CHR_SWAP - Swap two single-character variables
Up: Routine Descriptions
Previous: CHR_SKCHR - Skip over all specified characters in a string



CHR Character Handling Routines
Starlink User Note 40
A C Charles
P C T Rees
A J Chipperfield
2 August 1995
E-mail:ussc@star.rl.ac.uk