Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reverse comma-delimited string
Message
From
03/09/2019 14:46:57
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
03/09/2019 14:29:41
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01670542
Message ID:
01670544
Views:
96
>I have a string like "one, two, three" and I need it to be in the order "three, two, one".
>
>Does anybody have an efficient algorithm to do this?

LPARAMETERS tcText
LOCAL lnLines,lcText,x
LOCAL ARRAY laLines[1]
lnLines=ALINES(laLines,m.tcText,1,",")
lcText = laLines[m.lnLines]
FOR x = lnLines-1 TO 1 STEP -1
lcText = m.lcText + "," + laLines[m.x]
ENDFOR x
RETURN m.lcText
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform