BBC BASIC for Windows
Programming >> Libraries >> SORTLIB string sequence query
http://bb4w.conforums.com/index.cgi?board=libraries&action=display&num=1267900925

SORTLIB string sequence query
Post by mavison 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!

Martin
Re: SORTLIB string sequence query
Post by admin on Jun 27th, 2013, 10:21pm

on Mar 6th, 2010, 5:42pm, mavison wrote:
there is any means of sorting by straight ASCII code sequence?

Version 1.3 of the SORTLIB library provides that option:

http://tech.groups.yahoo.com/group/bb4w/message/20560

Richard.