[Issue 9699] strip functions should allow setting custom match character

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 12 06:16:49 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9699


bearophile_hugs at eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs at eml.cc


--- Comment #2 from bearophile_hugs at eml.cc 2013-03-12 06:16:47 PDT ---
Regarding this code I have two comments:     

C[] stripRight(C)(C[] str)
    if(isSomeChar!C)
{
    foreach_reverse(i, dchar c; str)
    {
        if(!std.uni.isWhite(c))
            return str[0 .. i + codeLength!C(c)];
    }

    return str[0 .. 0];
}


1) Isn't it enough a "return null;" at the end?


2) When I see such string functions I often think about stripping leading
values from a generic 1D array:
[0,0,0,0,10,7,1234,0]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list