Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: Match string from possible strings
Paul Danese
4/15/2008 3:25:00 PM
Also, using the facets gem you can turn "include?" around using "in?",
which might have a more intuitive feel.
require 'facets'
>a =3D "Test"
>arr =3D %w(Test Toast Tryst)
>arrgh =3D %w(Toast Tryst)
>a.in? arr
=3D>true
>a.in? arrgh
=3D>false
I saw a presentation on facets @ the Hartford rug a few weeks ago and I
thoroughly enjoy this gem now.
-----Original Message-----
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf
Of John Butler
Sent: Friday, April 11, 2008 8:44 AM
To: ruby-talk ML
Subject: Re: Match string from possible strings
Park Heesob wrote:
> Hi,
> ----- Original Message -----
> From: "John Butler" <johnnybutler7@gmail.com>
> Newsgroups: comp.lang.ruby
> To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
> Sent: Friday, April 11, 2008 7:05 PM
> Subject: Match string from possible strings
>=20
>=20
>> route a
>> else
>> route b
>> end
>>=20
>> Anyone know the quick way?
>>=20
>> JB
>=20
> Is this what you want?
>=20
> if [string1,string2,string3].include?("Test")
> ...
>=20
> Regards,
> Park Heesob
Yes,
This is what i have used,
thanks
JB
--=20
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Match string from possible strings
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password