Draw horizontal line left and right of some text (a single line)

You can add the lines using \hrulefill and create the line using \makebox[\linewidth]. The vertical alignment is a little tricky. I don't know how to raise the filler, so one way is to lower the text first and than raise it again with the lines.

\documentclass{article}

\newcommand*\ruleline[1]{\par\noindent\raisebox{.8ex}{\makebox[\linewidth]{\hrulefill\hspace{1ex}\raisebox{-.8ex}{#1}\hspace{1ex}\hrulefill}}}

\begin{document}

\hrule
Before\\
\ruleline{TestXg}
After

\end{document}

Result:

Result


\documentclass{minimal}

\def\headline#1{\hbox to \hsize{\hrulefill\quad\lower.3em\hbox{#1}\quad\hrulefill}}

\begin{document}    
\headline{Centered \ddag{} Symbol} 
\end{document}

headline macro example

Admittedly, this is a TeX solution but I think it is appropriate because this is where TeX is really great. If you need some vertical space after the headline you could incorporate a \medskip right before the last closing brace of the \headline definition. And on second thought: the .3em dimension should be better expressed using ex.