Sort list alphabetically- ignoring first character if it is a space

David V Glasgow dvglasgow at gmail.com
Mon Feb 20 16:15:50 EST 2023


I am trying to alphabetically sort a list of unique strings, some of which have a leading space character.  I need these to sort as if the second character is the first character rather than all space prefixed strings being bunched together.

I just had a hilarious conversation with ChatGPT on this challenge  We ended up having a disagreement about whether a keyword “ignoring” exists in Livecode.  Please tell me it doesn’t.  (although even if it does, I don’t think it helps me with my task)

Anyway, I did learn something, but not whether there is an elegant way to do this.

I can see how I could extract strings starting with a space, replace the first character with the second character, combine the lists, sort, then replace the doctored strings with the space prefixed originals.  

However, I couldn’t help but wonder if there is a better  solution.

Anyone?

Best wishes,

David G


More information about the use-livecode mailing list