How do I access the contents of the current region in Emacs Lisp?

emacs, lisp, region

Solution

`buffer-substring` together with `region-beginning` and `region-end` can do that.

Problem

I want to access the contents of the current region as a string within a function. For example: ``` (concat "stringa" (get-region-as-string) "stringb") ``` Thanks Ed

Original source