I searched like for 2 hours now and I didn't find anything. Can anyone
tell me, how i search an array? I got an array of strings and have to
search these. How do I manage to do this? Thx
Have you looked at the documentation for Enumerable#find and/or
Enumerable#grep?
Stefano
···
On Monday 07 February 2011 23:13:28 Benjamin S. wrote:
Hey everbody
I searched like for 2 hours now and I didn't find anything. Can anyone
tell me, how i search an array? I got an array of strings and have to
search these. How do I manage to do this? Thx
As I see it, with these methods i can only search for full strings. My
problem is, that i get a string and my search parameter is only a part
of this string (so find, include, find_index etc doesn't work...)
I don't want to be negative but I wonder if you have ever studied seriously one of the many Ruby books which could answer your question.
Such a basic question should not be asked in this forum. Please do your homework first.
Thiel
Op 7-2-2011 15:13, Benjamin S. schreef:
···
Hey everbody
I searched like for 2 hours now and I didn't find anything. Can anyone
tell me, how i search an array? I got an array of strings and have to
search these. How do I manage to do this? Thx
On Mon, 7 Feb 2011 23:22:20 +0900, Benjamin S. wrote:
As I see it, with these methods i can only search for full strings. My
problem is, that i get a string and my search parameter is only a part
of this string (so find, include, find_index etc doesn't work...)
On Mon, Feb 7, 2011 at 3:22 PM, Benjamin S. <benjamin.stauffacher@gmail.com> wrote:
As I see it, with these methods i can only search for full strings. My
problem is, that i get a string and my search parameter is only a part
of this string (so find, include, find_index etc doesn't work...)
Thiel. You could've given him a link in the same amount of time you spent drafting that email. This is a learning area dude. Either help, or don't reply.
-----Original Message-----
From: Thiel Chang [mailto:schang@wxs.nl]
Sent: Monday, February 07, 2011 12:51 PM
To: ruby-talk ML
Subject: Re: Find in Array
Hi Benjamin,
I don't want to be negative but I wonder if you have ever studied
seriously one of the many Ruby books which could answer your question.
Such a basic question should not be asked in this forum. Please do
your homework first.
Thiel
Op 7-2-2011 15:13, Benjamin S. schreef:
Hey everbody
I searched like for 2 hours now and I didn't find anything. Can anyone
tell me, how i search an array? I got an array of strings and have to
search these. How do I manage to do this? Thx
2011/2/7 Jesús Gabriel y Galán <jgabrielygalan@gmail.com>:
On Mon, Feb 7, 2011 at 3:22 PM, Benjamin S. > <benjamin.stauffacher@gmail.com> wrote:
As I see it, with these methods i can only search for full strings. My
problem is, that i get a string and my search parameter is only a part
of this string (so find, include, find_index etc doesn't work...)
You can use find/select with a regular expression:
I agree this is a learning area and I apolize to be negative to Ben. Of course, I could give him the solution but my remark should stimulate him to study the Ruby books. Its better and more enjoyable to find the solution of a (easy) programming problem yourself. On the other hand if you don't have the time or are in a hurry to get on with your program it's ok to use this forum.
Thiel
Op 7-2-2011 19:55, Clent Crumley schreef:
···
Thiel. You could've given him a link in the same amount of time you spent drafting that email. This is a learning area dude. Either help, or don't reply.
-----Original Message-----
From: Thiel Chang [mailto:schang@wxs.nl]
Sent: Monday, February 07, 2011 12:51 PM
To: ruby-talk ML
Subject: Re: Find in Array
Hi Benjamin,
I don't want to be negative but I wonder if you have ever studied
seriously one of the many Ruby books which could answer your question.
Such a basic question should not be asked in this forum. Please do
your homework first.
Thiel
Op 7-2-2011 15:13, Benjamin S. schreef:
Hey everbody
I searched like for 2 hours now and I didn't find anything. Can anyone
tell me, how i search an array? I got an array of strings and have to
search these. How do I manage to do this? Thx