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

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

Re: split-string case insensitive?


From: Pascal J. Bourguignon
Subject: Re: split-string case insensitive?
Date: Sun, 10 Aug 2008 17:24:54 +0200
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.2 (gnu/linux)

pwl_b <address@hidden> writes:

> Hi!
>
> I am trying to split a string in eLisp using split-string, and here is
> a sample outcome of it:
>
> (split-string "Abcade" "A" t)
> => ("bc" "de")
>
> The question is: Why it does not care about case of "A"? And is there
> a way to split string in case-sensitive manner?
>
> The strange thing to me is that split-string does accept regexp as a
> separator, but it still doesn't care about the cases e.g.:
>
> (split-string "A1ba2b" "A." t)
> => ("b" "b")
>
> I would appreciate any help given, and I am sorry if this question has
> an obvious answer but I couldn't find any on the Web.

It depends on the setting of the case-fold-search variable:

(let ((case-fold-search t))
  (split-string "Abcade" "A" t)) --> ("bc" "de")

(let ((case-fold-search nil))
  (split-string "Abcade" "A" t)) --> ("bcade")

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/

In a World without Walls and Fences, 
who needs Windows and Gates?


reply via email to

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