From: nobu.nokada@... Date: 2005-08-20T07:17:09+09:00 Subject: Re: Refactoring of File.basename Hi, At Sat, 20 Aug 2005 00:58:11 +0900, Daniel Berger wrote in [ruby-talk:152940]: > After a recent "idiomatic" thread, I decided to try and refactor the > core File.basename method. I think I did a pretty good job. It's about > 10 lines short, easier to read (I think), and self contained, i.e. no > calls to rmext(). It doesn't look easier to read for me. > if(strstr(base, ext)){ > int length = strlen(base) - strlen(ext); > int span = strcspn(base, ext); What does this intend? > def test_basename assert_equal("cat", Base.basename("cat.c", ".c")) -- Nobu Nakada