digitalmars.D.bugs - [Issue 9702] New: std.string.replace for single chars too?
- d-bugmail puremagic.com (28/28) Mar 12 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9702
http://d.puremagic.com/issues/show_bug.cgi?id=9702 Summary: std.string.replace for single chars too? Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: Phobos AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc The first form is accepted but the second form is rejected: import std.string: replace; void main() { auto s1 = "hello".replace("h", "a"); // OK auto s2 = "hello".replace('h', 'a'); // error } DMD 2.063alpha gives: temp.d(4): Error: no overload matches for replace(E, R1, R2)(E[] subject, R1 from, R2 to) if (isDynamicArray!(E[]) && isForwardRange!(R1) && isForwardRange!(R2) && (hasLength!(R2) || isSomeString!(R2))) Maybe it's worth supporting the second form too. The advantage is possibly a little more efficient algorithm, and more flexibility. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Mar 12 2013