  Explicit expressions are presented for general branching functions for cosets
of affine Lie algebras $\hat{g}$ with respect to subalgebras $\hat{g}^\prime$
for the cases where the corresponding finite dimensional algebras $g$ and
$g^\prime$ are such that $g$ is simple and $g^\prime$ is either simple or sums
of $u(1)$ terms. A special case of the latter yields the string functions. Our
derivation is purely algebraical and has its origin in the results on the BRST
cohomology presented by us earlier. We will here give an independent and simple
proof of the validity our results. The method presented here generalizes in a
straightforward way to more complicated $g$ and $g^\prime$ such as {\it e g }
sums of simple and $u(1)$ terms.
