Link to home
Start Free TrialLog in
Avatar of JakeB52
JakeB52

asked on

reverse a string


Is there any way to reverse a string similar to this "2000 2001 2004  " so it looks like "2004 2001 2000".

I have tried StrReverse (strYears) without any success.

Some important things to note:

1) The number of years may vary in a string
2) There will always be an undetermined number of spaces at the end of the string
3) I'm using Access 2000

Any help would be appreciated.

Avatar of softplus
softplus

dim sList$()
dim iCounter%
dim sDone$
sList = Split(sInput, " ")
for iCounter = ubound(sList) to lbound(sList) step -1
  sDone = sDone & " " & sList(iCounter)
next
sDone = Trim(sDone)

Done :)
ASKER CERTIFIED SOLUTION
Avatar of softplus
softplus

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Use this new function StrReverse().