We call a \emph{comb} a map $f:I\to [0,\infty)$, where $I$ is a compact interval, such that $\{f\ge \varepsilon\}$ is finite for any $\varepsilon$. A comb induces a (pseudo)-distance $d_f$ on $\{f=0\}$ defined by $d_f(s,t) = \max_{(s\wedge t, s\vee t)} f$. We describe the completion $\bar I$ of $\{f=0\}$ for this metric, which is a compact ultrametric space called \emph{comb metric space}.
Conversely, we prove that any compact, ultrametric space $(U,d)$ without isolated points is isometric to a comb metric space.
We show various examples of the comb representation of well-known ultrametric spaces: the Kingman coalescent, infinite sequences of a finite alphabet, the $p$-adic field and spheres of locally compact real trees.
In particular, for a rooted, locally compact real tree defined from its contour process $h$, the comb isometric to the sphere of radius $T$ centered at the root can be extracted from $h$ as the depths of its excursions away from $T$.