BBC BASIC for Windows
« SORTLIB string sequence query »
Welcome Guest. Please Login or Register. Apr 5th, 2018, 10:32pm
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
SORTLIB string sequence query
« Thread started on: Mar 6th, 2010, 5:42pm »
I have recently started to use SORTLIB to sort arrays. In general it works very well, but the sort sequence for string arrays caught me out.
I was expecting the 'Normal' string sort (FN_sortinit(0,0)) sequence to be as ASCII codes, eg basically 0-9, A-Z, a-z.
However, this is not what happens. It seems that (because the library uses call "CompareString") the sequence is actually 0-9, aA-zZ.
It seems that CompareString is very clever, and is designed to compare words in whatever language is being used, and tries to get associated words together.
If Ignore Case is used (FN_sortinit(0,1)) then the lower and upper case letters are mixed up, so you can get aaAaAAa.
Please can I ask if:
(a) the help file can be changed to give an indication of what the sequences of 'Normal' and 'IgnoreCase' actually mean for strings? This clue would have saved me a lot of time!
(b) there is any means of sorting by straight ASCII code sequence? I suspect it would mean adding a simple string compare option to the assembler in SORTLIB, as I do not think the StringCompare API provides such a simple functon!