From: "Michael W. Ryder" <_mwryder@...> Date: 2007-04-24T17:50:17+09:00 Subject: Re: Question regarding design of the String Class Robert Dober wrote: > On 4/24/07, Michael W. Ryder <_mwryder@worldnet.att.net> wrote: > >> I program for a living in Business Basic so I can't take a break from >> the language to learn Ruby. Instead, I am trying to convert functions >> from Business Basic to Ruby and may consider then trying to convert some >> of my programs to Ruby. I have already completed one of the function >> conversions and may post the results later. Part of the reason for the >> conversion would be the ability to "upgrade" the programs to use things >> like browsers and SQL instead of the glass tty and flat files built into >> Business Basic. > I see that makes it particularly difficult, well it just might be a > slower process. > My hint would than be to concentrate on things that seem logical to > you and continue discussing things that do not on this list. > The problem with the single item you chose is that it is indeed a > little odd, but useful in some circumstances. > Maybe you should just live with the str[i..i] notation for a while and > focus on other things. > Sorry for not being more helpful :( > Thats what I plan on doing. Of course my next project will really test me as I am going to have to see if there is a way to duplicate a function in Business Basic that returns the position of a string in another string. I know that if I "hard code" the search string I can use str =~ /test/ to get what I want for some cases. The problem is that I am trying to make test also a string and haven't figured out how to do this yet. Just using str.include? test returns either true or false but not the position of test in str. To make this even more complicated I want to be able to say something like a = pos(b,c,x) where b and c are strings and x is an integer. This would mean that the search only started on every x characters -- i.e. if b = "1234" and c = "234123411234" a would equal 9 rather than 3. Thanks for the input. > Cheers > Robert >> >> >> > Welcome to Ruby. >> > >> > Cheers >> > Robert >> > >> > >> >> > >