Then, I was misunderstanding your problem. I was believing it was because ‘l’ option had not worked as expected that you tried ‘n’ and ‘s’ options.
It is somewhat confusing that an extended ASCII sort is labelled as normal
for we don’t feet it natural
. It is called so presumably because that is the only sort order which was available in Nisus Writer Express 2.x. Perhaps it is Cocoa’s default sort order? … but now I’m just speculating.
Anyway, if you give an appropriate language object as the language argument, sort
command will return the expected results in most of cases. However, it is not so much intelligent as Sort Paragraphs commands when numbers are involved. You will not get “1<tab>abc, 2<tab>def, 13<tab>ghi” but “1<tab>abc, 13<tab>ghi, 2<tab>def” from the macro below as tab is not treated as a field separator.
Code: Select all
$a = Array.new "1\tabc", "2\tdef", "13\tghi"
$lang = Language.languageWithCode 'en_US'
$a.sort 'l', $lang
In that case, you have to use "01\tabc", "02\tdef", "13\tghi" or something alike.
Elements consisting of just numbers are sorted by their numerical value and you will get, for example, “1, 2, 13” even with ‘s’ option. I have never met a situation in which this behaviour would cause a problem but I tend to think ‘s’ option should be more strict.