[Issue 7281] std.string.reversed

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 12 10:53:10 PST 2012


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



--- Comment #1 from bearophile_hugs at eml.cc 2012-01-12 10:53:09 PST ---
This function is handy because the alternative is to use code like this, that
is much longer (3 or 4 lines long), it's not a single expression, and it needs
two copies of the original string (or a copy and a cast, or a copy and one
assume unique):


import std.algorithm: reverse;
void main() {
    string s = "red";
    char[] s1 = s.dup;
    s1.reverse();
    string sr = s1.idup;
}

-- 
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