C1[] stripPar(C1, C2)(C1[] txt, in C2 open = '(', in C2 close=')')
@safe pure if (isSomeChar!C1 && isSomeChar!C2) {
    while (txt.front == open && txt.back == close) {
        txt.popFront;
        txt.popBack;
    }

    return txt;
}

The next improvement step is to make it work on a Range.

Bye,
bearophile

Reply via email to