Summary: std.string.chomp documentation mismatch implementation
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: Phobos

--- Comment #0 from simendsjo <> 2010-08-09 14:43:53 
PDT ---
The documentation says
 * Returns s[] sans trailing delimiter[], if any.
 * If delimiter[] is null, removes trailing CR, LF, or CRLF, if any.

The implementation on the other hand returns the input string if delimiter is
null. So either the documentation or the implementation needs to be fixed.
If the implementation should work like the documentation, it could be something
like this:

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];
      return s;

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to