std.string.chomp error
Lars T. Kyllingstad
public at kyllingen.NOSPAMnet
Mon Aug 9 10:16:33 PDT 2010
On Mon, 09 Aug 2010 18:58:36 +0200, simendsjo wrote:
> The documentation says
> /*******************************************
> * Returns s[] sans trailing delimiter[], if any. * If delimiter[] is
> null, removes trailing CR, LF, or CRLF, if any. */
>
> To adhere to the documentation, chomp must be changed from:
>
> C[] chomp(C, C1)(C[] s, in C1[] delimiter) {
> if (endsWith(s, delimiter))
> {
> return s[0 .. $ - delimiter.length];
> }
> return s;
> }
>
> to:
>
> C[] chomp(C, C1)(C[] s, in C1[] delimiter) {
> if (delimiter == null)
> return chomp(s);
> else if (endsWith(s, delimiter))
> return s[0 .. $ - delimiter.length];
> else
> return s;
> }
Either that, or the documentation for it needs to be changed. Anyway, it
would be great if you'd report this.
http://d.puremagic.com/issues/
Thanks!
-Lars
More information about the Digitalmars-d-learn
mailing list