[Top][All Lists]

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

Re: Elisp: help on string operations

From: Michael Heerdegen
Subject: Re: Elisp: help on string operations
Date: Tue, 08 Nov 2016 15:16:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Hello Karl,

> I'd like to get a "Sorry" message for (1). Easy, if only I know how to
> count lines in strings (as opposed to buffers).

You could use `with-temp-buffer', insert the string and do your work
there.  Alternatively, go with `count-matches' or `split-string'.

>       (message (concat "result -> " result))

To avoid that a dynamically computed argument of `message' gets
interpreted with format specifier syntax considered, it's better to use
it like

        (message "%s" (compute-some-string-here))

>       (re-search-forward " \[\[.+\]\[" nil t 1)
That looks wrong.  You want to have a backslash char before the
brackets.  But since backslash is an escape character in the read syntax
of strings, you need to escape the backslash characters, which means
you need to double the backslashes.

Any questions left?



reply via email to

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