Hiding section titles when the section is empty

I have created a macro like this:

``````\newcommand{\showsection}[2]{
\ifstrequal{#2}{}{}{\section{#1} #2}
}
``````

It should be used like this in the document:

``````\showsection{Books}{
Do you know any good books?
}
``````

If `#2` is empty, as in this case below, the section title to not be shown:

``````\showsection{Books}{

}
``````

Unfortunately, with some macros inside, which should sometimes appear blank, somehow something is getting through. Perhaps it is an extra space? No text is visible. I have put `%` after every line of the macros which I placed inside. How can I get the section titles to disappear in this case?

-
Please have a look at the documentation of `etoolbox`. There are also described the commands `\ifblank` and `\ifstrempty`. Another mehtod is using the pacakge `xparse`. – Marco Daniel Dec 19 '11 at 12:52
Please mention important packages in the text, not just as tags. It is always good to post a add a minimal working example (MWE) that illustrates your problem exactly and lets people test their solutions easily. – Martin Scharrer Dec 19 '11 at 12:55

You have an end-of-line character after the opening `{` which causes a space. It might be better to check if the argument is a single space instead of being empty. You can add one space to the argument yourself to make sure the test is true for a real empty content.
Also you should add `%` after any `{` or `}` at the end of a line inside the macro definition.
``````\newcommand{\showsection}[2]{%