From: Stefano Crocco Date: 2008-06-09T00:11:00+09:00 Subject: Re: Search File Contents On Sunday 08 June 2008, Andy Dbest wrote: > Stefano Crocco wrote: > > On Sunday 08 June 2008, Andy Dbest wrote: > >> > at the beginning of the method, to see whether the argument you get is > >> > the one > >> > you expect? > >> > > >> > Stefano > >> > >> I tried the puts line, just inside the method and it does return '1.' > >> for me. It kind of annoying... > > > > Can you post a sample of the file you're searching in? This way, I can > > try > > your code myself and see what's going on. > > > > Stefano > > sure... > > here is an extract of the file > > 1. > > aaa.txt - bbb.txt > aac.txt - bbc.tct > > 2. > > aac.txt - bbb.txt > aaa.txt - bbc.txt I've tried it and it works even without the assignment. Are you sure there isn't any trailing space afer 1. in the method argument? Using puts as I suggested in my first post wouldn't have shown that. You can try examining the argument with p, instead of puts, which displays the string with special characters escaped and surrounded by quotes. If everything is correct, the line p week_num should output "1." If there are trailing spaces, you'll see something like "1. " Stefano