help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: case-insensitive string<


From: thierry . volpiatto
Subject: Re: case-insensitive string<
Date: Fri, 17 Apr 2009 17:07:08 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.92 (gnu/linux)

harven <harven@free.fr> writes:

> Nikolaj Schumacher <me@nschum.de> writes:
>
>> What's the fastest way to sort a large list of strings in a
>> case-insensitive order?
>>
>> Calling downcase on every string is rather expensive.  Does anyone know
>> a better way?
>
> The sort built-in function uses string< as predicate.
> You could use compare-strings instead. It has an option IGNORE-CASE.
> Hope that helps.
>
You can use th cl sort ==> sort*

(sort* (list "abc" "abd" "abCde" "cade" "ABC") 'string< :key 'downcase)
("abc" "ABC" "abCde" "abd" "cade")

But not sure it is faster than downcasing all strings before sorting.
Need testing.

-- 
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France





reply via email to

[Prev in Thread] Current Thread [Next in Thread]