Usage: $ordtok(TOKEN,C,?)
Will return entered numbers as ords (1.4.2 = 1st.2nd.4th) and as you can see, will sort them in reverse or put them in order (if you used $ordtok(4.1,46,nr) - it would return it in reverse)
Made by me.
alias ordtok {
var %x = 1, %otok = $1
while %x <= $numtok($1,$2) {
var %otok = $reptok(%otok,$gettok($1,%x,$2),$ord($gettok($1,%x,$2)),$2)
inc %x
}
return $sorttok(%otok,$2,$iif($3,nr,n))
}
The way it looks to is as follows.
His example: $ordtok(4.1,46,nr)
The number 4 and 1 will be given the proper $ord after them and in reverse order.
It will give: 4th 1st
The problem I see is that if one of the items in the group ends with a non-number it is just listed as it is. Perhaps have it either remove it or error out.
If you use: $ordtok(4.1,46)
It will give: 1st 4th