unknown wrote:
> Hi --
> 
> On Thu, 6 Jul 2006, j3n7il jones wrote:
> 
>>  aPos := Pos(value, str);
>> end;
>>
>> As you can see after begin, it calls a pascal function called "pos"
>>
>> which just looks for value(a string) within str (another string) and
>> returns a number, the position of value within str.
>>
>> Possible in ruby?
> 
> Of course -- and there's even a built-in method that does it :-)
> Actually a couple of them.  Check out String#index and String#rindex.
> 
>    str = "This is a string."
>    str.index("is")   # 2
>    str.rindex("is")  # 5 (i.e., last occurence)
>    str.index(/i./)   # 2 (using regex)
> 
> The =~ method/operator also returns an index.
> 
> 
> David


Thank you all for the quick responses, It's going to take some time to 
kill old habbits and learn new syntax, but it seems that it would be 
more powerfull in the long run. Everything so far is non-logical to me, 
but after some experaments im sure it will all come together :)

-- 
Posted via http://www.ruby-forum.com/.