# Ignore newline in LaTeX variable

I have some string in variable \somevar, eg. foo\\bar. How can I force LaTeX to ignore newline in \somevar. When I write content of the variable there should be

foo bar


and not

foo
bar

-
Why do you store a newline in your variable if you don't want to display it? Maybe you need to make a wrapper around your macro to split the usage? –  ℝaphink May 10 '11 at 12:23
The variable is in document class. Content of the variable comes from user's document and user can put newlines there. One time I can print the variable with newline and another time the newlines are not acceptable but this is still the same text. –  jesper May 10 '11 at 12:28
How about providing an option like \chapter does? You can write \chapter[alternative title]{title} where one can have newlines and the other can't. –  ℝaphink May 10 '11 at 12:30
\let\\=\relax

This will temporarily neuter the effect of \\.