Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / IanM's alphabetic string sorting? I can't find it :-(

Author
Message
Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 4th Nov 2011 16:41
I have read elsewhere on this forum that IanM should have made a plugin that can sort string in alphabetic order, my own code is not working correct :-( It should sort the strings depending on the first letter, then in sorted groups depending on the first and the second letter.



The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
sladeiw
10
Years of Service
User Offline
Joined: 16th May 2009
Location: UK
Posted: 4th Nov 2011 20:09 Edited at: 4th Nov 2011 20:11
Sounds like you're looking for his `Sort Array` command: (Matrix1Util_29)

SORT ARRAY Array()
SORT ARRAY Array(), Field [, Field [, Field [, Field [, Field[, Field]]]]]

Description

The first form of this command can be used to sort non-UDT arrays into order. If used on a UDT array, an error will be triggered.

The second form of this command can be used to sort UDT arrays into order. If used on a non-UDT array, an error will be triggered.

Fields are specified numerically - 1 is the first field, etc. If you specify a field that is beyond the end of the format provided, an error will be triggered. It is not an error to specify a field of 0, but the field will be ignored.

If the field is specified as a negative number, the field will be sorted in reverse sequence.

When sorting strings, null strings are arranged first, followed by empty strings, and then finally by ASCII value of the string contents.
Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 4th Nov 2011 20:20
Oh sweet Now I am all the wiser regarding those plug ins Thank you sladeiw

What is UDT and non-UDT arrays?

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Nov 2011 20:26


I've defined OtherArray as a string array, but it works the same for floats, integers, dwords etc.

Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 5th Nov 2011 13:27
I have small question: I have an array with two dimensions, i.e user$(10,2), I want to sort them depending on user$(1,1) and I want to have user$(1,2) just to follow with the first, how is that done?

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 5th Nov 2011 14:24
My plug-in won't sort that data correct - there's no implicit link between one dimension and another in arrays, so there's no way for the plug-in to do that.

If you have data that is linked in that way, then you should probably be storing it in a UDT instead as a logical unit of data:


Cybermind
16
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 5th Nov 2011 16:52
Okay, thank you

The byte chrunchers are coming...
DIVIDING BY ZERO/BECAUSE WE SUCK...

Login to post a reply

Server time is: 2019-10-15 10:18:09
Your offset time is: 2019-10-15 10:18:09