std.string.chomp error

simendsjo simen.endsjo at pandavre.com
Mon Aug 9 14:44:37 PDT 2010


On 09.08.2010 19:16, Lars T. Kyllingstad wrote:
> 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

Ok; http://d.puremagic.com/issues/show_bug.cgi?id=4608


More information about the Digitalmars-d-learn mailing list