Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Why should we subsidize intellectual curiosity?" -- Ronald Reagan


devel / comp.lang.tcl / Sort string list in alphabetical order but ignore case

SubjectAuthor
* Sort string list in alphabetical order but ignore caseShaun Kulesa
+* Sort string list in alphabetical order but ignore casegreg
|`* Sort string list in alphabetical order but ignore caseShaun Kulesa
| `- Sort string list in alphabetical order but ignore casegreg
`- Sort string list in alphabetical order but ignore caseRobert Heller

1
Sort string list in alphabetical order but ignore case

<de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12201&group=comp.lang.tcl#12201

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:1990:b0:412:2dd3:e0ff with SMTP id u16-20020a05622a199000b004122dd3e0ffmr129637qtc.1.1696171333786;
Sun, 01 Oct 2023 07:42:13 -0700 (PDT)
X-Received: by 2002:a05:6870:1a8c:b0:1d5:8e96:7d85 with SMTP id
ef12-20020a0568701a8c00b001d58e967d85mr3417450oab.1.1696171333465; Sun, 01
Oct 2023 07:42:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 1 Oct 2023 07:42:12 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=139.222.232.226; posting-account=Be2r4goAAACg4Ko_BkJ0V-RlkGAdXGng
NNTP-Posting-Host: 139.222.232.226
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com>
Subject: Sort string list in alphabetical order but ignore case
From: shaunkul...@gmail.com (Shaun Kulesa)
Injection-Date: Sun, 01 Oct 2023 14:42:13 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Shaun Kulesa - Sun, 1 Oct 2023 14:42 UTC

I am trying to order a list alphabetically but is ordering it so the strings starting with uppercase are ordered first then the strings with lowercase are ordered last.

How can I ignore the case of the strings?

Example output:

Ttk_PackBox
Ttk_PadBox
Ttk_PlaceBox
Ttk_RelievePadding
Ttk_StickBox
Ttk_UniformPadding
after
append
apply
argc
argv
argv0
array
attemptckalloc
attemptckrealloc
auto_execok
auto_import
auto_load
auto_mkindex
auto_path
auto_qualify
auto_reset
bell
bgerror

Re: Sort string list in alphabetical order but ignore case

<e47748d1-5448-4779-92f4-500568eeb2a7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12202&group=comp.lang.tcl#12202

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:620a:4393:b0:76d:ada1:d841 with SMTP id a19-20020a05620a439300b0076dada1d841mr154145qkp.7.1696175768198;
Sun, 01 Oct 2023 08:56:08 -0700 (PDT)
X-Received: by 2002:a05:6871:6a95:b0:1c8:c0ce:5f34 with SMTP id
zf21-20020a0568716a9500b001c8c0ce5f34mr3487790oab.11.1696175767896; Sun, 01
Oct 2023 08:56:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!1.us.feeder.erje.net!feeder.erje.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 1 Oct 2023 08:56:07 -0700 (PDT)
In-Reply-To: <2c241884-b5af-433e-9138-8eb2344ebe81n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=185.250.212.8; posting-account=99ziWAoAAADLScDbI_CyfIcpa_gFZ0zh
NNTP-Posting-Host: 185.250.212.8
References: <de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com> <2c241884-b5af-433e-9138-8eb2344ebe81n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e47748d1-5448-4779-92f4-500568eeb2a7n@googlegroups.com>
Subject: Re: Sort string list in alphabetical order but ignore case
From: gregor.e...@googlemail.com (greg)
Injection-Date: Sun, 01 Oct 2023 15:56:08 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2078
 by: greg - Sun, 1 Oct 2023 15:56 UTC

Shaun Kulesa schrieb am Sonntag, 1. Oktober 2023 um 16:43:36 UTC+2:
> Just to note, I am using lsort.

# https://www.tcl-lang.org/man/tcl/TclCmd/lsort.htm
# -ascii
# Use string comparison with Unicode code-point collation order
# (the name is for backward-compatibility reasons.) This is the default.

package require struct::list

set l [split {Ttk_PackBox
Ttk_PadBox
Ttk_PlaceBox
Ttk_RelievePadding
Ttk_StickBox
Ttk_UniformPadding
after
append
apply
argc
argv
argv0
array
attemptckalloc
attemptckrealloc
auto_execok
auto_import
auto_load
auto_mkindex
auto_path
auto_qualify
auto_reset
bell
bgerror} '\n']

set s [ ::struct::list shuffle $l]
puts "l:\n $l"
puts "s:\n $s"
puts "nocase:\n [lsort -nocase $s]"
puts "ascii:\n [lsort -ascii $s]"
puts "default:\n [lsort $s]"
puts "dictionary:\n [lsort -dictionary $s]"

Re: Sort string list in alphabetical order but ignore case

<60a9f809-de13-4d7c-b1e7-6cddb41ed4c2n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12203&group=comp.lang.tcl#12203

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:622a:181b:b0:415:15f9:c070 with SMTP id t27-20020a05622a181b00b0041515f9c070mr140764qtc.6.1696176075494;
Sun, 01 Oct 2023 09:01:15 -0700 (PDT)
X-Received: by 2002:a05:6808:238b:b0:3a7:7e66:2197 with SMTP id
bp11-20020a056808238b00b003a77e662197mr4661424oib.2.1696176075099; Sun, 01
Oct 2023 09:01:15 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 1 Oct 2023 09:01:14 -0700 (PDT)
In-Reply-To: <e47748d1-5448-4779-92f4-500568eeb2a7n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=139.222.232.226; posting-account=Be2r4goAAACg4Ko_BkJ0V-RlkGAdXGng
NNTP-Posting-Host: 139.222.232.226
References: <de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com>
<2c241884-b5af-433e-9138-8eb2344ebe81n@googlegroups.com> <e47748d1-5448-4779-92f4-500568eeb2a7n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <60a9f809-de13-4d7c-b1e7-6cddb41ed4c2n@googlegroups.com>
Subject: Re: Sort string list in alphabetical order but ignore case
From: shaunkul...@gmail.com (Shaun Kulesa)
Injection-Date: Sun, 01 Oct 2023 16:01:15 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Shaun Kulesa - Sun, 1 Oct 2023 16:01 UTC

Thanks so much for the arg examples, it has helped me understand each arg.

I completely missed the nocase arg on the docs.

Thanks!

Re: Sort string list in alphabetical order but ignore case

<17058a54-fe91-42e4-9467-b0d472745d13n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12204&group=comp.lang.tcl#12204

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:a05:6214:1910:b0:65a:f49b:3e46 with SMTP id er16-20020a056214191000b0065af49b3e46mr126455qvb.5.1696176485920;
Sun, 01 Oct 2023 09:08:05 -0700 (PDT)
X-Received: by 2002:a05:6870:b7b1:b0:1d5:8fad:fb03 with SMTP id
ed49-20020a056870b7b100b001d58fadfb03mr3711580oab.4.1696176485482; Sun, 01
Oct 2023 09:08:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Sun, 1 Oct 2023 09:08:04 -0700 (PDT)
In-Reply-To: <60a9f809-de13-4d7c-b1e7-6cddb41ed4c2n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=185.250.212.8; posting-account=99ziWAoAAADLScDbI_CyfIcpa_gFZ0zh
NNTP-Posting-Host: 185.250.212.8
References: <de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com>
<2c241884-b5af-433e-9138-8eb2344ebe81n@googlegroups.com> <e47748d1-5448-4779-92f4-500568eeb2a7n@googlegroups.com>
<60a9f809-de13-4d7c-b1e7-6cddb41ed4c2n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <17058a54-fe91-42e4-9467-b0d472745d13n@googlegroups.com>
Subject: Re: Sort string list in alphabetical order but ignore case
From: gregor.e...@googlemail.com (greg)
Injection-Date: Sun, 01 Oct 2023 16:08:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1765
 by: greg - Sun, 1 Oct 2023 16:08 UTC

Shaun Kulesa schrieb am Sonntag, 1. Oktober 2023 um 18:01:18 UTC+2:
> Thanks so much for the arg examples, it has helped me understand each arg.
>
> I completely missed the nocase arg on the docs.
>
> Thanks!

# https://www.tcl-lang.org/man/tcl/TclCmd/lsort.htm
#
# -nocase
# Causes comparisons to be handled in a case-insensitive manner.
# Has no effect if combined with the -dictionary, -integer, or -real options.

Re: Sort string list in alphabetical order but ignore case

<ShWdnbtmdMQ9BoT4nZ2dnZfqnPidnZ2d@giganews.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=12205&group=comp.lang.tcl#12205

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 01 Oct 2023 16:17:36 +0000
MIME-Version: 1.0
From: hel...@deepsoft.com (Robert Heller)
Organization: Deepwoods Software
X-Newsreader: TkNews 3.0 (1.2.15)
Subject: Re: Sort string list in alphabetical order but ignore case
In-Reply-To: <de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com>
References: <de6561d4-3672-4cd0-bec5-65612eab2e9dn@googlegroups.com>
Newsgroups: comp.lang.tcl
Content-Type: text/plain;
charset="us-ascii"
Originator: heller@sharky4.deepsoft.com
Message-ID: <ShWdnbtmdMQ9BoT4nZ2dnZfqnPidnZ2d@giganews.com>
Date: Sun, 01 Oct 2023 16:17:36 +0000
Lines: 54
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-V3nGnfpr5cpIKwMK70aG5x/C2gQYg603/eSnjLVyROrlo04GOCucBHSpxP40+4rUBxB19fnw9xmxSes!DkacYFERYTVDlkIm+4woJbe9+61wy61E2+hyOyenFttZQKc1LFA0j4iXYnInaupbxvozjlKKW1dN!DJc=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Robert Heller - Sun, 1 Oct 2023 16:17 UTC

From 'man 3tcl lsort':

-dictionary
Use dictionary-style comparison. This is the same as -ascii ex-
cept (a) case is ignored except as a tie-breaker and (b) if two
strings contain embedded numbers, the numbers compare as inte-
gers, not characters. For example, in -dictionary mode, bigBoy
sorts between bigbang and bigboy, and x10y sorts between x9y and
x11y. Overrides the -nocase option.

At Sun, 1 Oct 2023 07:42:12 -0700 (PDT) Shaun Kulesa <shaunkulesa@gmail.com> wrote:

>
> I am trying to order a list alphabetically but is ordering it so the strings starting with uppercase are ordered first then the strings with lowercase are ordered last.
>
> How can I ignore the case of the strings?
>
> Example output:
>
> Ttk_PackBox
> Ttk_PadBox
> Ttk_PlaceBox
> Ttk_RelievePadding
> Ttk_StickBox
> Ttk_UniformPadding
> after
> append
> apply
> argc
> argv
> argv0
> array
> attemptckalloc
> attemptckrealloc
> auto_execok
> auto_import
> auto_load
> auto_mkindex
> auto_path
> auto_qualify
> auto_reset
> bell
> bgerror
>
>

--
Robert Heller -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software -- Custom Software Services
http://www.deepsoft.com/ -- Linux Administration Services
heller@deepsoft.com -- Webhosting Services

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor