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: pwl_b
Subject: Re: split-string case insensitive?
Date: Mon, 11 Aug 2008 01:40:52 -0700 (PDT)
User-agent: G2/1.0

On 10 Sie, 17:24, address@hidden (Pascal J. Bourguignon)
wrote:
> 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?

It does work! Thanks a lot!


reply via email to

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