This is an ugly hack, exploiting counting the number of columns with \@addamp, stepping a counter, which is reset every time a new tabular environment is started.
I don't claim this to work for any occasion.
\documentclass{article}
\usepackage{xpatch}
\newcounter{colcntr}
\makeatletter
\xpatchcmd{\@addamp}{\if@firstamp}{\stepcounter{colcntr}\if@firstamp}{}{}
\makeatother
\newcommand{\allcolumns}[2]{%
\multicolumn{\number\value{colcntr}}{#1}{#2}%
}
\AtBeginEnvironment{tabular}{\setcounter{colcntr}{0}}
\begin{document}
\begin{tabular}{|l|l|l|}
Long & table column & stuff \tabularnewline
\allcolumns{|c|}{Foo stuff}
\end{tabular}
\end{document}

\hlineand longer latex commands I dare not type lest I err. In other words: are you saying that I can the same functionality can be obtained with tricks using\arrayrulwidth? – Yossi Gil Feb 13 '17 at 16:23\caption(which in that package is in a\multicolumnjust as described) but one difficulty is defining what you mean by number of columns, if you use\begin{tabular}{cccc}but every row just has two entries, you would want to generate\multicolumn{2}not\multicolumn{4}ams matrices for example are always declared with more columns than used. – David Carlisle Feb 13 '17 at 17:01\hlinedoes not need to know the number of columns. It just needs the width of the box. – Feb 13 '17 at 17:45\multicolumn? – Yossi Gil Feb 13 '17 at 18:11