emacs-devel
[Top][All Lists]
Advanced

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

Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?


From: Bastien
Subject: Re: Why (substring "abc" 0 4) does not return "abc" instead of an error?
Date: Mon, 16 Jul 2012 21:30:12 +0200
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux)

Lars Magne Ingebrigtsen <address@hidden> writes:

> Tassilo Horn <address@hidden> writes:
>
>> I'm not even able to come up with some concrete use-case where I'd
>> like to have the suggested behavior.
>
> It's a very common use case for me.  I know that a string can't be
> longer than X for some particular use, so I have to say
>
> (insert (if (> (length string) 4)
>             (substring string 0 4)
>           string))

Well, see `string-head' and `string-tail' in my other message.

-- 
 Bastien



reply via email to

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