DMD 2.006 release

Bill Baxter dnewsgroup at billbaxter.com
Tue Oct 16 10:42:47 PDT 2007


Walter Bright wrote:
> Strings are now invariant. More library overhauls, new library modules. 
> These changes exacerbated problems with const/volatile, so next up is 
> overhauling that.
> 
> http://www.digitalmars.com/d/changelog.html
> http://ftp.digitalmars.com/dmd.2.006.zip

Wow.  Phobos 2.x is really on the move!

Any chance we could get a std.string.startsWith and std.string.endsWith?

They are simple one-liners, but often useful.  Here's my D1.x 
implementation:

     bool startsWith(string s, string sub) {
         return (s.length>=sub.length && s[0..sub.length]==sub);
     }
     bool endsWith(string s, string sub) {
         return (s.length>=sub.length && s[$-sub.length..$]==sub);
     }

If there's some subtle bug in the above (zero length strings?), my 
apologies -- but that's all the more reason they should be in the library!

--bb



More information about the Digitalmars-d-announce mailing list