Hi Russell
my answer is approximate.
The best solution is (especially for it lists much long):
SET EXACT ON
lcTestString='test;test;test1;test;test1;test2'
lcNewString=''
IF ALINES(aWords,m.lcTestString,";")>0
ASORT(aWords)
FOR i=ALEN(aWords) TO 1 STEP -1
i=ASCAN(aWords,aWords[m.i])
lcNewString=m.lcNewString+","+aWords[m.i]
ENDFOR
ENDIF
lcNewString=SUBSTR(m.lcNewString,2)
? lcNewString
* result words is in descending order
SET EXACT ON
lcTestString='test;test;test1;test;test1;test2'
lcNewString=''
IF ALINES(aWords,m.lcTestString,";")>0
ASORT(aWords,1,-1,1)
FOR i=ALEN(aWords) TO 1 STEP -1
i=ASCAN(aWords,aWords[m.i])
lcNewString=m.lcNewString+","+aWords[m.i]
ENDFOR
ENDIF
lcNewString=SUBSTR(m.lcNewString,2)
? lcNewString
* result words is in ascending order
Fabio
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only