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

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

Re: Elisp: help on string operations


From: Karl Voit
Subject: Re: Elisp: help on string operations
Date: Tue, 8 Nov 2016 18:36:01 +0100
User-agent: slrn/pre1.0.0-18 (Linux)

* Michael Heerdegen <address@hidden> wrote:
> Hello Karl,

Hallo Michael!

>> 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'.

Ah, so there are no string operations on strings in "memory" but
rather (lots of) string operations on strings in buffers. I see.

>>       (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))

Good point.

>>       (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.

That's it, I see.

Man, I hate those different levels of escaping everywhere :-(

> Any questions left?

I got help from John Kitchin as well. So far I need to digest
everything I learned for now and try to come up with a solution that
works.

Danke!

-- 
All in all, one of the most disturbing things today is the definitive
fact that the NSA, GCHQ, and many more government organizations are
massively terrorizing the freedom of us and the next generations.
                                                  http://Karl-Voit.at




reply via email to

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