New UserLib command: SortStructuredArrayFS()
- netmaestro
- PureBasic Bullfrog
- Posts: 8425
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Re: New UserLib command: SortStructuredArrayFS()
In 2006 I was lucky to code something that compiled at all, so the definitive answer is: I haven't a clue if it's stable or not. When something seemed to work, I stopped coding and moved on to something else.
BERESHEIT
- Kwai chang caine
- Always Here
- Posts: 5342
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: New UserLib command: SortStructuredArrayFS()
Never mind MASTER, it's really normal
Each code you create is perfect
So, the codes is like the programmers, they get older a day
And sometime it not works after numerous time...
For me, it's a little bit more difficult
When i create a new code..it is already surely very old, because never it works
Thanks a lot to exist MASTER
Each code you create is perfect
So, the codes is like the programmers, they get older a day
And sometime it not works after numerous time...
For me, it's a little bit more difficult
When i create a new code..it is already surely very old, because never it works
Thanks a lot to exist MASTER
The happiness is a road...
Not a destination
Not a destination
Re: New UserLib command: SortStructuredArrayFS()
I had to sort a structured array once based on a number in a string and ended up just doing a bubble sort on that number because the built in options all do in-order. You can do it with anything just adjusting delay with big data.
Code: Select all
Procedure sort()
Protected i.l
Protected indy.l=1
Protected title$
Protected desc$
Protected file$
For i=0 To ArraySize(items())
If i>0
If Val(StringField(items(i)\title$,2," "))<Val(StringField(items(i-1)\title$,2," "))
;move up
title$=items(i-1)\title$ : desc$=items(i-1)\desc$ : file$=items(i-1)\file$
items(i-1)\title$=items(i)\title$ : items(i-1)\desc$=items(i)\desc$ : items(i-1)\file$=items(i)\file$
items(i)\title$=title$ : items(i)\desc$=desc$ : items(i)\file$=file$
file$="" : title$="" : desc$=""
i=0
EndIf
EndIf
Delay(1)
Next
EndProcedure
The truth hurts.