Stewart Gordon:

I'd be inclined to define a function like

string stripLineBreak(string s) {
    while (s.length != 0 && s[$-1] != '\n' && s[$-1] != '\r') {
        s = s[0..$-1];
    }
    return s;
}

See the chop and chomp functions in std.string.

Bye,
bearophile

Reply via email to