sorting words ?

Geoff Canyon gcanyon at gmail.com
Fri Dec 11 18:24:44 EST 2015


On Fri, Dec 11, 2015 at 3:28 AM, Mark Waddingham <mark at livecode.com> wrote:

> I don't think I do agree with 'trying to do something sensible with the
> whitespace' as I don't really see why that would be useful. If you break
> down a string into a sequence of segments (I'll stop using word since it
> perhaps obfuscates the issue slightly ;)) then what use is the whitespace
> after that? Particularly if it has been reordered in some 'arbitrary' way.
> (Here I mean 'arbitrary' in the sense that there are a great many choices
> one could make as to how one might 'do something with' the whitespace here
> and as such any one choice can be seen as arbitrary - I don't think there
> are any particularly logical arguments one could make as to why to favour
> one choice over another beyond personal taste and explicit specific
> use-case).


​I agree that "sensible" is difficult to define here. I suspect that by far
the most common use case here would be a string where all the words are
single-space delimited, which is why I suggested the other minority use
cases all be forced into that pattern, i.e.

the quick    "brown  fox"      jumped over    --contains spaces and tabs
the[space]quick[tab]"brown[tab]fox"[space][tab]jumped[tab]over[tab]

would sort to this (adding in your terminating delimiter modification from
above):

"brown    fox" jumped over quick the
"brown[tab]fox"[space]jumped[space]over[space]quick[space]the[space]

​I understand that doesn't preserve the string's length, but (at least to
me) it's the sensible solution.​



More information about the use-livecode mailing list